nicklima/strapi-blog-frontend-next

View on GitHub
lib/getPaths.ts

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
import { fetchAPI } from "lib"

export async function getPaths(path: string) {
  const rsp = await fetchAPI(path, { fields: ["slug"] })

  return {
    paths: rsp.data.map((item: { attributes: { slug: string } }) => ({
      params: {
        slug: item.attributes.slug,
      },
    })),
    fallback: false,
  }
}