Skip to content

Commit 4218169

Browse files
feat: strip trailing slash
Closes #57
1 parent 409436c commit 4218169

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

src/frontend/package-lock.json

Lines changed: 20 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/frontend/src/lib/consts/backend.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { env } from '$env/dynamic/public';
2+
import { strip_trailing_slash } from '$lib/functions/urls';
3+
const envrionment_variable = env.PUBLIC_BACKEND_API ?? 'http://localhost:8000';
24

3-
export const BACKEND_API = env.PUBLIC_BACKEND_API ?? 'http://localhost:8000';
5+
export const BACKEND_API = strip_trailing_slash(envrionment_variable);
46
export const LOGIN_URL = `${BACKEND_API}/login`;
57
export const USER_URL = `${BACKEND_API}/user`;
68
export const CONFIG_URL = `${BACKEND_API}/config`;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
export function resolve_partial_path(path: string) {
22
return new URL(path, window.location.href).pathname;
33
}
4+
5+
export function strip_trailing_slash(url: string) {
6+
return url.replace(/\/$/, '');
7+
}

0 commit comments

Comments
 (0)