import { configureStore } from '@reduxjs/toolkit';
import historyReducer from '../reducers/history';
import templateReducer from '../reducers/template';

export default function configStore() {
  const store = configureStore({
    reducer: {
      history: historyReducer,
      template: templateReducer,
    },
    middleware: getDefaultMiddleware =>
      getDefaultMiddleware({
        serializableCheck: {
          ignoredActions: ['persist/PERSIST'],
        },
      }),
  });
  return store;
}

export type RootState = ReturnType<ReturnType<typeof configStore>['getState']>;
export type AppDispatch = ReturnType<typeof configStore>['dispatch'];

// 导出类型
export * from './types';
