From 106788602e6620cb8de11c28cee164d1eda37df4 Mon Sep 17 00:00:00 2001 From: Sean Ho Date: Thu, 12 Aug 2021 12:16:07 +0800 Subject: [PATCH] update cms endpoint --- gatsby-config.js | 2 +- gatsby-node.js | 69 ++++++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/gatsby-config.js b/gatsby-config.js index 2147589df9c..26d1d1a96fe 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -223,7 +223,7 @@ module.exports = { { resolve: '@directus/gatsby-source-directus', options: { - url: `https://amammustofa.com`, + url: `https://cms.deriv.com`, dev: { refresh: '5s', }, diff --git a/gatsby-node.js b/gatsby-node.js index 1d79fc5a7ef..18d5df268f2 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -251,40 +251,41 @@ exports.onCreateWebpackConfig = ({ actions, getConfig }, { ...options }) => { }) } -exports.createPages = async ({ reporter, actions, graphql }) => { - const { createPage } = actions - const articleTemplate = path.resolve(__dirname, 'src/templates/article.js') +// TODO: To be updated to the new shape of the API of the new endpoint +// exports.createPages = async ({ reporter, actions, graphql }) => { +// const { createPage } = actions +// const articleTemplate = path.resolve(__dirname, 'src/templates/article.js') - // Query our published articles - const result = await graphql(` - query MyQuery { - directus { - articles(filter: { status: { _eq: "published" } }) { - article_title - article_url - translations { - article_title - languages_id - } - } - } - } - `) +// Query our published articles +// const result = await graphql(` +// query MyQuery { +// directus { +// articles(filter: { status: { _eq: "published" } }) { +// article_title +// article_url +// translations { +// article_title +// languages_id +// } +// } +// } +// } +// `) - if (result.errors) { - reporter.panic(result.errors) - } - const articles = result.data.directus.articles +// if (result.errors) { +// reporter.panic(result.errors) +// } +// const articles = result.data.directus.articles - articles.forEach((article) => { - createPage({ - path: `/blog/articles/${article.article_url}`, - component: articleTemplate, - context: { - locale: 'en', - pathname: `/blog/articles/${article.article_url}`, - slug: article.article_url, - }, - }) - }) -} +// articles.forEach((article) => { +// createPage({ +// path: `/blog/articles/${article.article_url}`, +// component: articleTemplate, +// context: { +// locale: 'en', +// pathname: `/blog/articles/${article.article_url}`, +// slug: article.article_url, +// }, +// }) +// }) +// }