feat: Support running under subpath (#1451)

This commit is contained in:
Roberto Fernández Iglesias
2026-03-12 22:11:11 +01:00
committed by GitHub
parent 61a3ff55cc
commit 5e6195b252
24 changed files with 97 additions and 33 deletions
+6 -2
View File
@@ -8,24 +8,28 @@ import { jwtDecode } from 'jwt-decode';
import Config from '../constants/Config';
const PATH = Config.BASE_PATH || '/';
export const setAccessToken = (accessToken) => {
const { exp } = jwtDecode(accessToken);
const expires = new Date(exp * 1000);
Cookies.set(Config.ACCESS_TOKEN_KEY, accessToken, {
expires,
path: PATH,
secure: window.location.protocol === 'https:',
sameSite: 'strict',
});
Cookies.set(Config.ACCESS_TOKEN_VERSION_KEY, Config.ACCESS_TOKEN_VERSION, {
expires,
path: PATH,
});
};
export const removeAccessToken = () => {
Cookies.remove(Config.ACCESS_TOKEN_KEY);
Cookies.remove(Config.ACCESS_TOKEN_VERSION_KEY);
Cookies.remove(Config.ACCESS_TOKEN_KEY, { path: PATH });
Cookies.remove(Config.ACCESS_TOKEN_VERSION_KEY, { path: PATH });
};
export const getAccessToken = () => {