k8s redesign complete

This commit is contained in:
Eric Gullickson
2025-09-18 22:44:30 -05:00
parent cb98336d5e
commit 040da4c759
12 changed files with 1803 additions and 445 deletions

View File

@@ -16,6 +16,11 @@ export const apiClient: AxiosInstance = axios.create({
},
});
// Auth readiness flag to avoid noisy 401 toasts during mobile auth initialization
let authReady = false;
export const setAuthReady = (ready: boolean) => { authReady = ready; };
export const isAuthReady = () => authReady;
// Request interceptor for auth token with mobile debugging
apiClient.interceptors.request.use(
async (config: InternalAxiosRequestConfig) => {
@@ -44,6 +49,10 @@ apiClient.interceptors.response.use(
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
if (error.response?.status === 401) {
// Suppress early 401 toasts until auth is ready (mobile silent auth race)
if (!authReady) {
return Promise.reject(error);
}
// Enhanced 401 handling for mobile token issues
const errorMessage = error.response?.data?.message || '';
const isTokenIssue = errorMessage.includes('token') || errorMessage.includes('JWT') || errorMessage.includes('Unauthorized');
@@ -72,4 +81,4 @@ apiClient.interceptors.response.use(
}
);
export default apiClient;
export default apiClient;