No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

40 líneas
924 B

  1. // types
  2. import { createSlice } from '@reduxjs/toolkit';
  3. // initial state
  4. const initialState = {
  5. openItem: ['dashboard'],
  6. defaultId: 'dashboard',
  7. openComponent: 'buttons',
  8. drawerOpen: false,
  9. componentDrawerOpen: true
  10. };
  11. // ==============================|| SLICE - MENU ||============================== //
  12. const menu = createSlice({
  13. name: 'menu',
  14. initialState,
  15. reducers: {
  16. activeItem(state, action) {
  17. state.openItem = action.payload.openItem;
  18. },
  19. activeComponent(state, action) {
  20. state.openComponent = action.payload.openComponent;
  21. },
  22. openDrawer(state, action) {
  23. state.drawerOpen = action.payload.drawerOpen;
  24. },
  25. openComponentDrawer(state, action) {
  26. state.componentDrawerOpen = action.payload.componentDrawerOpen;
  27. }
  28. }
  29. });
  30. export default menu.reducer;
  31. export const { activeItem, activeComponent, openDrawer, openComponentDrawer } = menu.actions;