@@ -69,15 +69,12 @@ export default function Doc(
6969
7070export async function getStaticPaths ( ) {
7171 // Connect and configure the TerminusClient
72- const client = new TerminusClient . WOQLClient (
73- "https://cloud.terminusdb.com/TerminatorsX" ,
74- {
75- 76- organization : "TerminatorsX" ,
77- db : "terminusCMS_docs" ,
78- token : process . env . TERMINUSDB_API_TOKEN ,
79- }
80- )
72+ const client = new TerminusClient . WOQLClient ( process . env . TERMINUSDB_API_ENDPOINT , {
73+ user : process . env . TERMINUSDB_USER ,
74+ organization : process . env . TERMINUSDB_TEAM ,
75+ db : process . env . TERMINUSDB_DB ,
76+ token : process . env . TERMINUSDB_API_TOKEN ,
77+ } )
8178 const docs = await client . getDocument ( { "@type" : "Page" , as_list : true } )
8279 const exceptions = [ "python" , "openapi" , "javascript" ]
8380 const paths = docs
@@ -93,10 +90,10 @@ export async function getStaticProps({ params }) {
9390 headers : { Authorization : `Token ${ process . env . TERMINUSDB_API_TOKEN } ` } ,
9491 }
9592 const doc = await axios . post (
96- "https://cloud.terminusdb.com/TerminatorsX/ api/graphql/TerminatorsX/terminusCMS_docs" ,
93+ ` ${ process . env . TERMINUSDB_API_ENDPOINT } / api/graphql/${ process . env . TERMINUSDB_TEAM } / ${ process . env . TERMINUSDB_DB } ` ,
9794 {
9895 query : `query {
99- Page(filter: {slug: {eq: "${ params [ ' name' ] } "}}) {
96+ Page(filter: {slug: {eq: "${ params [ " name" ] } "}}) {
10097 slug,
10198 title {
10299 value
@@ -117,7 +114,7 @@ export async function getStaticProps({ params }) {
117114 const docResult = doc . data . data . Page [ 0 ]
118115 let html = ""
119116 if ( docResult [ "body" ] !== null ) {
120- html = await renderMarkdown ( docResult [ "body" ] [ "value" ] )
117+ html = await renderMarkdown ( docResult [ "body" ] ?. [ "value" ] ?? "" )
121118 }
122119 const entry = { html : html , document : docResult }
123120 return { props : { entry, menu } }
0 commit comments