import { IMrktngPage } from './../../types/index.d' import { Context } from '@nuxt/types/app' export class PageController { collection: string slug: string context: Context page: IMrktngPage | null = null constructor(collection: string, slug: string, context: Context) { this.collection = collection this.slug = slug this.context = context } async fetchPage() { const page = ( await this.context.app.$axios.$get(`/api/custompages/pages/index`) ) if (!page) { return this.context.error({ statusCode: 404, message: 'Страница не найдена', }) } this.page = page return page } }