-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CLEANUP] Pouvoir utiliser les slices pages coté pix-pro.
Merge pull request #191 from 1024pix/use-custom-page-in-pro-site
- Loading branch information
Showing
2 changed files
with
62 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file was deleted.
Oops, something went wrong.