mirror of
https://github.com/hexastack/hexabot
synced 2024-11-27 22:42:11 +00:00
feat(frontend): added fix for the base url
This commit is contained in:
parent
7b57d50c47
commit
2871fb432c
@ -28,7 +28,11 @@ export const getFromQuery = ({
|
|||||||
|
|
||||||
export const buildURL = (baseUrl: string, relativePath: string): string => {
|
export const buildURL = (baseUrl: string, relativePath: string): string => {
|
||||||
try {
|
try {
|
||||||
const url = new URL(relativePath, baseUrl);
|
const normalizedBaseUrl = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
|
||||||
|
const normalizedRelativePath = relativePath.startsWith("/")
|
||||||
|
? relativePath.slice(1)
|
||||||
|
: relativePath;
|
||||||
|
const url = new URL(normalizedRelativePath, normalizedBaseUrl);
|
||||||
|
|
||||||
return url.toString();
|
return url.toString();
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user