mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 23:16:59 +00:00
14 lines
366 B
TypeScript
14 lines
366 B
TypeScript
export function getStrapiURL(path = "") {
|
|
return `${
|
|
process.env.NEXT_PUBLIC_STRAPI_API_URL || "http://localhost:1337"
|
|
}${path}`
|
|
}
|
|
|
|
// Helper to make GET requests to Strapi
|
|
export async function fetchAPI(path : string ) {
|
|
const requestUrl = getStrapiURL(path)
|
|
const response = await fetch(requestUrl)
|
|
const data = await response.json()
|
|
return data
|
|
}
|