aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/slices/authorization.ts20
-rw-r--r--src/store.ts21
2 files changed, 41 insertions, 0 deletions
diff --git a/src/slices/authorization.ts b/src/slices/authorization.ts
new file mode 100644
index 0000000..c70039d
--- /dev/null
+++ b/src/slices/authorization.ts
@@ -0,0 +1,20 @@
+import { createSlice } from "@reduxjs/toolkit";
+
+const authorizationSlice = createSlice({
+ name: "authorization",
+ initialState: {
+ authorizing: false,
+ },
+ reducers: {
+ startAuthorizing: (state) => {
+ state.authorizing = true;
+ },
+ finishAuthorizing: (state) => {
+ state.authorizing = false;
+ },
+ },
+});
+
+export const { startAuthorizing, finishAuthorizing } = authorizationSlice.actions;
+
+export default authorizationSlice.reducer;
diff --git a/src/store.ts b/src/store.ts
new file mode 100644
index 0000000..1b9807b
--- /dev/null
+++ b/src/store.ts
@@ -0,0 +1,21 @@
+import { combineReducers, configureStore } from "@reduxjs/toolkit";
+
+import authorizationReducer from "./slices/authorization";
+
+const rootReducer = combineReducers({
+ authorization: authorizationReducer
+});
+
+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>