Skip to content

Commit

Permalink
[CLEANUP] Pouvoir utiliser les slices pages coté pix-pro.
Browse files Browse the repository at this point in the history
Merge pull request #191 from 1024pix/use-custom-page-in-pro-site
  • Loading branch information
MelanieMEB authored Oct 13, 2020
2 parents a52f7e2 + 26118e8 commit 38e12fe
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 61 deletions.
62 changes: 62 additions & 0 deletions pages/pix-pro/_custom-page.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<div>
<div v-if="type === 'simple_page'">
<simple-page :content="document.data" />
</div>
<div v-if="type === 'slices_page'">
<slice-zone :slices="document.data.body" />
</div>
</div>
</template>

<script>
import { documentFetcher } from '~/services/document-fetcher'
import SimplePage from '@/components/SimplePage'
import SliceZone from '@/components/SliceZone'
export default {
name: 'CustomPage',
nuxtI18n: {
paths: {
fr: '/:uid',
'fr-fr': '/:uid',
'en-gb': '/:uid',
},
},
components: {
SliceZone,
SimplePage,
},
async asyncData({ params, app, req, error, currentPagePath }) {
try {
const document = await documentFetcher(
app.$prismic,
app.i18n,
req
).getPageByUid(params.uid)
const meta = document.data.meta
return { currentPagePath, meta, document }
} catch (e) {
error({ statusCode: 404, message: 'Page not found' })
}
},
computed: {
type() {
return this.document.type
},
title() {
return this.document.data.title[0].text
},
},
head() {
const meta = this.$getMeta(this.meta, this.currentPagePath, this.$prismic)
return {
meta,
title: this.title,
}
},
}
</script>

<style lang="scss"></style>
61 changes: 0 additions & 61 deletions pages/pix-pro/_simple-page.vue

This file was deleted.

0 comments on commit 38e12fe

Please sign in to comment.