This commit is contained in:
Виталий Лавшонок
2025-10-23 16:34:13 +03:00
parent 8df53a4ed5
commit e3ce191b44
23 changed files with 236 additions and 170 deletions

30
src/redux/slices/store.ts Normal file
View File

@@ -0,0 +1,30 @@
import { createSlice, PayloadAction} from "@reduxjs/toolkit";
// Типы данных
interface StorState {
menu: {
activePage: string;
}
}
// Инициализация состояния
const initialState: StorState = {
menu: {
activePage: "",
}
};
// Slice
const storeSlice = createSlice({
name: "store",
initialState,
reducers: {
setMenuActivePage: (state, activePage: PayloadAction<string>) => {
state.menu.activePage = activePage.payload;
},
},
});
export const { setMenuActivePage } = storeSlice.actions;
export const storeReducer = storeSlice.reducer;

View File

@@ -1,5 +1,6 @@
import { configureStore } from "@reduxjs/toolkit";
import { authReducer } from "./slices/auth";
import { storeReducer } from "./slices/store";
// использование
@@ -15,6 +16,7 @@ export const store = configureStore({
reducer: {
//user: userReducer,
auth: authReducer,
store: storeReducer,
},
});