Added uiState slice

This commit is contained in:
Dmitriy Shishkov 2021-10-17 16:42:09 +03:00
parent 5396870d2f
commit 4877008708
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060
2 changed files with 23 additions and 1 deletions

View File

@ -1,7 +1,9 @@
import { configureStore } from "@reduxjs/toolkit";
import uiStateReducer from "./slices/uiState";
const store = configureStore({
reducer: {},
reducer: { uiState: uiStateReducer },
});
export type RootState = ReturnType<typeof store.getState>;

View File

@ -0,0 +1,20 @@
import { createSlice } from "@reduxjs/toolkit";
export const uiStateSlice = createSlice({
name: "uiState",
initialState: {
addBarOpen: false,
},
reducers: {
open: (state) => {
state.addBarOpen = true;
},
close: (state) => {
state.addBarOpen = false;
},
},
});
export const { open, close } = uiStateSlice.actions;
export default uiStateSlice.reducer;