22 lines
759 B
TypeScript
22 lines
759 B
TypeScript
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
import { applyMiddleware, createStore } from 'redux';
|
|
import { persistStore, persistReducer } from 'redux-persist';
|
|
import { thunk } from 'redux-thunk';
|
|
|
|
import rootReducer from './reducers';
|
|
|
|
const persistConfig = {
|
|
key: 'root',
|
|
storage: AsyncStorage,
|
|
blacklist: ['isLoggingIn', 'isFetchingUserData', 'isRegisteringUser', 'loginError'],
|
|
};
|
|
|
|
const persistedReducer = persistReducer(persistConfig, rootReducer);
|
|
|
|
export const store = createStore(persistedReducer, applyMiddleware(...[thunk]));
|
|
export const persistor = persistStore(store);
|
|
|
|
export type AppStore = typeof store;
|
|
export type RootState = ReturnType<AppStore['getState']>;
|
|
export type AppDispatch = AppStore['dispatch'];
|