aboutsummaryrefslogtreecommitdiffstats
path: root/src/store.ts
blob: e516bbabc9d93169f253a1376de28342cfc738a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { combineReducers, configureStore } from "@reduxjs/toolkit";

import authorizationReducer from "./slices/authorization";
import voteReducer from "./slices/votes";

const rootReducer = combineReducers({
    authorization: authorizationReducer,
    vote: voteReducer
});

export const setupStore = (preloadedState?: Partial<RootState>) => {
    return configureStore({
        reducer: rootReducer,
        preloadedState
    });
};

const formsStore = setupStore();

export default formsStore;

export type RootState = ReturnType<typeof rootReducer>
export type AppStore = ReturnType<typeof setupStore>