mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 19:12:50 +00:00
refresh token fix
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
authStorage,
|
||||
refreshAccessToken,
|
||||
logout,
|
||||
setToken,
|
||||
} from '@ema-platform/auth';
|
||||
import type { AuthUser, CurrentProfile } from '@ema-platform/auth';
|
||||
import { preferencesReducer } from './preferences.slice';
|
||||
@@ -36,7 +37,11 @@ export const store = configureStore({
|
||||
});
|
||||
|
||||
configureTokenRefresh({
|
||||
onTokenExpired: refreshAccessToken,
|
||||
onTokenExpired: async () => {
|
||||
const token = await refreshAccessToken();
|
||||
store.dispatch(setToken(token));
|
||||
return token;
|
||||
},
|
||||
onAuthFailure: () => {
|
||||
store.dispatch(logout());
|
||||
window.location.href = '/login';
|
||||
|
||||
Reference in New Issue
Block a user