mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
fix: respect BASE_PATH in redirects, comparisons, and cookie consent paths
This commit is contained in:
@@ -10,6 +10,7 @@ import { useTranslation } from "react-i18next";
|
||||
import type { TFunction } from "i18next";
|
||||
import { springAuth } from "@app/auth/springAuthClient";
|
||||
import { clearPlatformAuthOnLoginInit } from "@app/extensions/authSessionCleanup";
|
||||
import { stripBasePath } from "@app/constants/app";
|
||||
import type {
|
||||
Session,
|
||||
User,
|
||||
@@ -167,7 +168,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
// Clear any platform-specific cached auth on login page init.
|
||||
if (
|
||||
typeof window !== "undefined" &&
|
||||
window.location.pathname.startsWith("/login")
|
||||
stripBasePath(window.location.pathname).startsWith("/login")
|
||||
) {
|
||||
await clearPlatformAuthOnLoginInit();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AxiosInstance, AxiosError, InternalAxiosRequestConfig } from "axios";
|
||||
import { withBasePath } from "@app/constants/app";
|
||||
|
||||
let isRefreshing = false;
|
||||
let failedQueue: Array<{
|
||||
@@ -89,9 +90,10 @@ async function refreshAuthToken(client: AxiosInstance): Promise<string> {
|
||||
clearJwtTokenFromStorage();
|
||||
|
||||
// Redirect to login
|
||||
if (window.location.pathname !== "/login") {
|
||||
const loginPath = withBasePath("/login");
|
||||
if (window.location.pathname !== loginPath) {
|
||||
console.log("[API Client] Redirecting to login page...");
|
||||
window.location.href = "/login";
|
||||
window.location.href = loginPath;
|
||||
}
|
||||
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user