Skip to content

Commit

Permalink
Update production backend url
Browse files Browse the repository at this point in the history
  • Loading branch information
joonatanaatos committed Jan 3, 2024
1 parent 823fc4e commit a3008ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion admin-panel/.env.production
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_BACKEND_URL=https://kukasoittaa.joonatanaatos.fi
REACT_APP_BACKEND_URL=https://kukasoittaa.joonatanaatos.fi/api
5 changes: 4 additions & 1 deletion admin-panel/src/util/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ export const setApiToken = (token: string) => {
apiToken = token;
};

const joinPaths = (path1: string, path2: string) =>
`${path1.replace(/\/$/, '')}/${path2}`;

export const request = async <T>(
path: (string | number)[],
options?: RequestInit,
): Promise<T> => {
const url = new URL(backendUrl);
url.pathname = path.join('/');
url.pathname = joinPaths(url.pathname, path.join('/'));
const finalUrl = url.toString();

return await fetch(finalUrl, {
Expand Down

0 comments on commit a3008ad

Please sign in to comment.