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 }) => {
|
||||
const { createPage } = actions
|
||||
const template = path.resolve('src/templates/Project.jsx')
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const template = path.resolve('src/templates/Project.jsx')
|
||||
|
||||
resolve(
|
||||
graphql(`
|
||||
{
|
||||
allProjectsYaml {
|
||||
edges {
|
||||
node {
|
||||
slug
|
||||
}
|
||||
}
|
||||
const result = await graphql(`
|
||||
{
|
||||
allProjectsYaml {
|
||||
edges {
|
||||
node {
|
||||
slug
|
||||
}
|
||||
}
|
||||
`).then(result => {
|
||||
if (result.errors) reject(result.errors)
|
||||
}
|
||||
}
|
||||
`)
|
||||
|
||||
result.data.allProjectsYaml.edges.forEach(({ node }) => {
|
||||
const { slug } = node
|
||||
if (result.errors) throw result.errors
|
||||
|
||||
createPage({
|
||||
path: slug,
|
||||
component: template,
|
||||
context: { slug }
|
||||
})
|
||||
})
|
||||
result.data.allProjectsYaml.edges.forEach(({ node }) => {
|
||||
const { slug } = node
|
||||
|
||||
resolve()
|
||||
})
|
||||
)
|
||||
createPage({
|
||||
path: slug,
|
||||
component: template,
|
||||
context: { slug }
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
"dependencies": {
|
||||
"classnames": "^2.2.6",
|
||||
"file-saver": "^2.0.0",
|
||||
"gatsby": "^2.0.80",
|
||||
"gatsby": "^2.0.85",
|
||||
"gatsby-image": "^2.0.25",
|
||||
"gatsby-plugin-favicon": "^3.1.5",
|
||||
"gatsby-plugin-matomo": "^0.6.0",
|
||||
@ -67,7 +67,7 @@
|
||||
"eslint-loader": "^2.1.1",
|
||||
"eslint-plugin-graphql": "^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",
|
||||
"ora": "^3.0.0",
|
||||
"prepend": "^1.0.2",
|
||||
|
Loading…
Reference in New Issue
Block a user