update usermanagement to legacy mode

This commit is contained in:
mengstabketemaw
2026-06-18 11:25:26 +03:00
parent 3a528c9515
commit 2feaaf1ee4
13 changed files with 158 additions and 57 deletions

View File

@@ -1,6 +1,13 @@
import { configureStore } from '@reduxjs/toolkit';
import { baseApi } from '@ema-platform/api';
import { authReducer, signupReducer, configureAuthStorage, authStorage } from '@ema-platform/auth';
import { baseApi, configureTokenRefresh } from '@ema-platform/api';
import {
authReducer,
signupReducer,
configureAuthStorage,
authStorage,
refreshAccessToken,
logout,
} from '@ema-platform/auth';
import type { AuthUser } from '@ema-platform/auth';
configureAuthStorage('ema-backoffice');
@@ -25,5 +32,13 @@ export const store = configureStore({
getDefaultMiddleware().concat(baseApi.middleware),
});
configureTokenRefresh({
onTokenExpired: refreshAccessToken,
onAuthFailure: () => {
store.dispatch(logout());
window.location.href = '/login';
},
});
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;