Skip to content

Commit

Permalink
feat: created a dynamic page that requests dpl-cms data and paragraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasGross committed Dec 20, 2024
1 parent 6ab61d6 commit 515f9f2
Show file tree
Hide file tree
Showing 6 changed files with 503 additions and 160 deletions.
23 changes: 23 additions & 0 deletions app/[...path]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from "react"

import { fetcher } from "@/lib/graphql/fetchers/dpl-cms.fetcher"
import { GetPageByPathDocument, GetPageByPathQuery } from "@/lib/graphql/generated/dpl-cms/graphql"

async function page(props: { params: Promise<{ path: string[] }> }) {
const params = await props.params

const { path } = params

const data = await fetcher<GetPageByPathQuery, { path: string }>(GetPageByPathDocument, {
path: path.join("/"),
})()

return (
<div>
page
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
)
}

export default page
3 changes: 2 additions & 1 deletion codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { loadEnvConfig } = require("@next/env")

loadEnvConfig(process.cwd())

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
const config: CodegenConfig = {
overwrite: true,
generates: {
Expand All @@ -15,7 +16,7 @@ const config: CodegenConfig = {
schema: {
[`${process.env.NEXT_PUBLIC_GRAPHQL_SCHEMA_ENDPOINT_DPL_CMS}`]: {
headers: {
Authorization: `Basic ${process.env.GRAPHQL_SCHEMA_ENDPOINT_BASIC_TOKEN_DPL_CMS}`,
Authorization: `Basic ${process.env.NEXT_PUBLIC_GRAPHQL_BASIC_TOKEN_DPL_CMS}`,
},
},
},
Expand Down
Loading

0 comments on commit 515f9f2

Please sign in to comment.