mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
remove promises
This commit is contained in:
parent
be24d54266
commit
4709eee3d8
@ -58,36 +58,29 @@ exports.onCreateNode = ({ node, actions }) => {
|
|||||||
//
|
//
|
||||||
exports.createPages = async ({ actions, graphql }) => {
|
exports.createPages = async ({ actions, graphql }) => {
|
||||||
const { createPage } = actions
|
const { createPage } = actions
|
||||||
|
const template = path.resolve('src/templates/Project.jsx')
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
const result = await graphql(`
|
||||||
const template = path.resolve('src/templates/Project.jsx')
|
{
|
||||||
|
allProjectsYaml {
|
||||||
resolve(
|
edges {
|
||||||
graphql(`
|
node {
|
||||||
{
|
slug
|
||||||
allProjectsYaml {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`).then(result => {
|
}
|
||||||
if (result.errors) reject(result.errors)
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
result.data.allProjectsYaml.edges.forEach(({ node }) => {
|
if (result.errors) throw result.errors
|
||||||
const { slug } = node
|
|
||||||
|
|
||||||
createPage({
|
result.data.allProjectsYaml.edges.forEach(({ node }) => {
|
||||||
path: slug,
|
const { slug } = node
|
||||||
component: template,
|
|
||||||
context: { slug }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
resolve()
|
createPage({
|
||||||
})
|
path: slug,
|
||||||
)
|
component: template,
|
||||||
|
context: { slug }
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"file-saver": "^2.0.0",
|
"file-saver": "^2.0.0",
|
||||||
"gatsby": "^2.0.80",
|
"gatsby": "^2.0.85",
|
||||||
"gatsby-image": "^2.0.25",
|
"gatsby-image": "^2.0.25",
|
||||||
"gatsby-plugin-favicon": "^3.1.5",
|
"gatsby-plugin-favicon": "^3.1.5",
|
||||||
"gatsby-plugin-matomo": "^0.6.0",
|
"gatsby-plugin-matomo": "^0.6.0",
|
||||||
@ -67,7 +67,7 @@
|
|||||||
"eslint-loader": "^2.1.1",
|
"eslint-loader": "^2.1.1",
|
||||||
"eslint-plugin-graphql": "^3.0.1",
|
"eslint-plugin-graphql": "^3.0.1",
|
||||||
"eslint-plugin-prettier": "^3.0.1",
|
"eslint-plugin-prettier": "^3.0.1",
|
||||||
"eslint-plugin-react": "^7.12.0",
|
"eslint-plugin-react": "^7.12.2",
|
||||||
"lighthouse": "^4.0.0-alpha.2-3.2.1",
|
"lighthouse": "^4.0.0-alpha.2-3.2.1",
|
||||||
"ora": "^3.0.0",
|
"ora": "^3.0.0",
|
||||||
"prepend": "^1.0.2",
|
"prepend": "^1.0.2",
|
||||||
|
Loading…
Reference in New Issue
Block a user