{"size": 1670, "ext": "js", "max_stars_repo_path": "gatsby-node.js", "max_stars_repo_name": "RobertDanielsson/Mildegruppen", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gatsby-node.js", "max_issues_repo_name": "RobertDanielsson/Mildegruppen", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gatsby-node.js", "max_forks_repo_name": "RobertDanielsson/Mildegruppen", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.5675675676, "max_line_length": 70, "alphanum_fraction": 0.4766467066}
const path = require("path")
const slash = require("slash")

exports.createPages = ({ graphql, actions }) => {
  const { createPage } = actions

  // return graphql(
  //   `
  //     {
  //       allContentfulTeam {
  //         edges {
  //           node {
  //             slug
  //           }
  //         }
  //       }
  //     }
  //   `
  // )
  //   .then(result => {
  //     if (result.errors) {
  //       console.log("error with contentful data", result.errors)
  //     }

  //     const teamTemplate = path.resolve("./src/templates/team.tsx")

  //     result.data.allContentfulTeam.edges.forEach(team => {
  //       createPage({
  //         path: `/teams/${team.node.slug}`,
  //         component: slash(teamTemplate),
  //         context: {
  //           slug: team.node.slug,
  //         },
  //       })
  //     })
  //   })
  //   .catch(error => {
  //     console.log("Error with contentfl data", error)
  //   })

  return graphql(`
    {
      allContentfulStandardsida {
        nodes {
          slug
        }
      }
    }
  `)
    .then(result => {
      if (result.errors) {
        console.log("error with contentful data", result.errors)
      }

      const standardPageTemplate = path.resolve(
        "./src/templates/StandardPage.tsx"
      )

      result.data.allContentfulStandardsida.nodes.forEach(page => {
        console.log("page", page)
        createPage({
          path: `${page.slug}`,
          component: slash(standardPageTemplate),
          context: {
            slug: page.slug,
          },
        })
      })
    })
    .catch(error => {
      console.log("error with contentful data", error)
    })
}
