mirror of
https://github.com/hexastack/hexabot
synced 2025-03-10 14:25:42 +00:00
Update frontend/src/utils/URL.ts
Co-authored-by: Mohamed Marrouchi <marrouchi.mohamed@gmail.com>
This commit is contained in:
parent
daa2e0611f
commit
9f10cb38d4
@ -29,11 +29,11 @@ export const getFromQuery = ({
|
||||
|
||||
export const buildURL = (baseUrl: string, relativePath: string): string => {
|
||||
try {
|
||||
new URL(baseUrl);
|
||||
} catch {
|
||||
throw new Error(`Invalid base URL: ${baseUrl}`);
|
||||
}
|
||||
|
||||
const url = new URL(relativePath, baseUrl);
|
||||
|
||||
return url.toString();
|
||||
} catch {
|
||||
throw new Error(`Invalid base URL: ${baseUrl}`);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user