ui frotneedn fixes
This commit is contained in:
@@ -231,6 +231,18 @@ export async function fetchAPI(endpoint: string, options?: RequestInit & { timeo
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
// Retry failed - parse and throw the retry error (not the original 401)
|
||||
let retryError: any = new Error(retryResponse.statusText);
|
||||
retryError.status = retryResponse.status;
|
||||
try {
|
||||
const retryErrorData = JSON.parse(retryText);
|
||||
retryError.message = retryErrorData.error || retryErrorData.message || retryResponse.statusText;
|
||||
retryError.data = retryErrorData;
|
||||
} catch (e) {
|
||||
retryError.message = retryText.substring(0, 200) || retryResponse.statusText;
|
||||
}
|
||||
throw retryError;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,6 +250,7 @@ export async function fetchAPI(endpoint: string, options?: RequestInit & { timeo
|
||||
// Refresh failed, clear auth state and force re-login
|
||||
const { logout } = useAuthStore.getState();
|
||||
logout();
|
||||
throw refreshError;
|
||||
}
|
||||
} else {
|
||||
// No refresh token available, clear auth state
|
||||
|
||||
Reference in New Issue
Block a user