mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 19:12:50 +00:00
feat: implement concurrent-safe token refreshing with session-aware error handling
This commit is contained in:
@@ -41,8 +41,13 @@ export const baseQueryWithReauth: BaseQueryFn<
|
||||
try {
|
||||
await _onTokenExpired();
|
||||
result = await baseQuery(args, api, extraOptions);
|
||||
} catch {
|
||||
_onAuthFailure?.();
|
||||
} catch (err) {
|
||||
// Only a rejected refresh token ends the session. A network blip or a
|
||||
// 5xx leaves the original 401 for the screen to report, rather than
|
||||
// throwing the user out of a session that is still valid.
|
||||
if ((err as { sessionExpired?: boolean })?.sessionExpired) {
|
||||
_onAuthFailure?.();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_onAuthFailure?.();
|
||||
|
||||
Reference in New Issue
Block a user