You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
380 B
15 lines
380 B
export function getStrapiMedia(url) { |
|
if (url == null) { |
|
return null |
|
} |
|
|
|
// Return the full URL if the media is hosted on an external provider |
|
if (url.startsWith("http") || url.startsWith("//")) { |
|
return url |
|
} |
|
|
|
// Otherwise prepend the URL path with the Strapi URL |
|
return `${ |
|
process.env.NEXT_PUBLIC_STRAPI_API_URL || "http://localhost:1337" |
|
}${url}` |
|
}
|
|
|