mars-v2-frontend/src/utils/url.ts
Linkie Link 26f1ef4a2c
Fix docker build (#805)
* fix: fixed the docker build

* tidy: cleanup
2024-02-14 11:58:48 +01:00

13 lines
350 B
TypeScript

export const getUrl = (baseUrl: string, path: string): string => {
const isPlaceholder = baseUrl.split('APP_').length > 1
if (isPlaceholder) return baseUrl + '/' + path
const url = new URL(baseUrl)
if (process.env.NEXT_PUBLIC_API_KEY)
return `${url.href}${path}?x-apikey=${process.env.NEXT_PUBLIC_API_KEY}`
return url.href + path
}