This commit is contained in:
2023-06-15 00:11:07 +04:00
parent 24222f4521
commit 293b6ea295
6 changed files with 395 additions and 323 deletions

View File

@@ -1,17 +1,17 @@
import directus from '~/lib/directus'
export const getServerSideProps = async () => {
const { data: pages } = await directus.items('pages').readByQuery({
limit: 1,
})
// export const getServerSideProps = async () => {
// const { data: pages } = await directus.items('pages').readByQuery({
// limit: 1,
// })
return {
paths: pages.map((p) => ({ params: { slug: p.slug } })),
fallback: false, // false or "blocking"
}
}
// return {
// paths: pages.map((p) => ({ params: { slug: p.slug } })),
// fallback: false, // false or "blocking"
// }
// }
export const getStaticProps = async ({ params }) => {
export const getServerSideProps = async ({ params }) => {
const { slug } = params
const {
@@ -24,6 +24,9 @@ export const getStaticProps = async ({ params }) => {
},
},
})
if (!page) return { notFound: true }
return { props: { page } }
}