Return URL instance from getApiUrl

This commit is contained in:
Linus Groh
2019-09-27 22:12:10 +01:00
parent 600934183a
commit d01de41e1f
2 changed files with 9 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ export const getApiUrl = path => {
? config.api.baseUrl.slice(1)
: config.api.baseUrl;
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
return `${normalizedBaseUrl}${normalizedPath}`;
return new URL(`${normalizedBaseUrl}${normalizedPath}`);
};
export const isIsoDate = s => ISO_DATE_REGEXP.test(s);