43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
/*
|
|
* File: store.ts
|
|
* Description: Redux store configuration for the Radiologist App
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|
|
|
|
import { configureStore } from '@reduxjs/toolkit';
|
|
import rootReducer from './rootReducer';
|
|
import { persistStore, persistReducer, PersistConfig } from 'redux-persist';
|
|
import storage from '@react-native-async-storage/async-storage';
|
|
|
|
|
|
const persistConfig: PersistConfig<any> = {
|
|
key: 'root',
|
|
storage,
|
|
version: 1,
|
|
whitelist: ['auth']
|
|
};
|
|
|
|
// Configure the Redux store
|
|
const persistedReducer = persistReducer(persistConfig, rootReducer);
|
|
|
|
export const store = configureStore({
|
|
reducer: persistedReducer,
|
|
middleware: (getDefaultMiddleware) =>
|
|
getDefaultMiddleware({
|
|
serializableCheck: {
|
|
ignoredActions: ['persist/PERSIST'], // Ignore persist actions to avoid the non-serializable warning
|
|
},
|
|
}),
|
|
});
|
|
|
|
|
|
// Export store and types for use throughout the app
|
|
export type AppDispatch = typeof store.dispatch;
|
|
export const persistor = persistStore(store);
|
|
|
|
/*
|
|
* End of File: store.ts
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|