35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
|
// @ts-nocheck
|
||
|
// import generated apis
|
||
|
|
||
|
import { AnyAction, combineReducers, configureStore, ThunkDispatch } from '@reduxjs/toolkit';
|
||
|
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
|
||
|
|
||
|
import authReducer from '@prokyon/auth/slice';
|
||
|
import { AUTH_REDUCER_NAME } from '@prokyon/auth/types';
|
||
|
import { ROOT_REDUCER_NAME } from '@prokyon/constants/redux';
|
||
|
|
||
|
import { emptyApi } from '../api/emptyApi';
|
||
|
|
||
|
type prokyonReducer = {
|
||
|
[AUTH_REDUCER_NAME]: typeof authReducer;
|
||
|
};
|
||
|
|
||
|
const store = configureStore({
|
||
|
reducer: {
|
||
|
[ROOT_REDUCER_NAME]: combineReducers<prokyonReducer>({
|
||
|
[AUTH_REDUCER_NAME]: authReducer,
|
||
|
}),
|
||
|
[emptyApi.reducerPath]: emptyApi.reducer,
|
||
|
},
|
||
|
middleware: (gDM) => [...gDM({ serializableCheck: false }).concat([emptyApi.middleware])],
|
||
|
devTools: process.env.NODE_ENV === 'development'
|
||
|
});
|
||
|
|
||
|
export type RootState = ReturnType<typeof store.getState>;
|
||
|
export type AppDispatch = ThunkDispatch<RootState, unknown, AnyAction>;
|
||
|
|
||
|
export const useAppDispatch: () => AppDispatch = useDispatch;
|
||
|
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
||
|
|
||
|
export default store;
|