1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-07-01 06:11:43 +02:00
market/gatsby-node.js

80 lines
1.7 KiB
JavaScript
Raw Normal View History

const path = require('path')
// const { config } = require('./src/config/ocean')
2020-06-30 13:32:16 +02:00
exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
node: {
// 'fs' fix for squid.js
fs: 'empty'
}
})
}
exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions
// Create pages for all assets
const assetDetailsTemplate = path.resolve(
2020-07-07 09:43:45 +02:00
'src/components/templates/AssetDetails.tsx'
)
const result = await graphql(`
query {
allOceanAsset {
edges {
node {
did
main {
type
name
dateCreated
author
license
price
datePublished
files {
contentType
index
}
}
additionalInformation {
description
deliveryType
termsAndConditions
access
}
}
}
}
}
`)
if (result.errors) {
throw result.errors
}
await result.data.allOceanAsset.edges.forEach(({ node }) => {
const path = `/asset/${node.did}`
createPage({
path,
component: assetDetailsTemplate,
context: { did: node.did }
})
})
}
// exports.onCreatePage = async ({ page, actions }) => {
// const { createPage } = actions
// // page.matchPath is a special key that's used for matching pages
// // only on the client.
// const handleClientSideOnly = page.path.match(/^\/asset/)
// if (handleClientSideOnly) {
// page.matchPath = '/asset/*'
// // Update the page.
// createPage(page)
// }
// }