Update frontend/src/utils/URL.ts

Co-authored-by: Mohamed Marrouchi <marrouchi.mohamed@gmail.com>
This commit is contained in:
Kartik Buttan
2024-09-17 21:34:47 +05:30
committed by GitHub
parent daa2e0611f
commit 9f10cb38d4

View File

@@ -29,11 +29,11 @@ export const getFromQuery = ({
export const buildURL = (baseUrl: string, relativePath: string): string => {
try {
new URL(baseUrl);
const url = new URL(relativePath, baseUrl);
return url.toString();
} catch {
throw new Error(`Invalid base URL: ${baseUrl}`);
}
const url = new URL(relativePath, baseUrl);
return url.toString();
};