27 lines
653 B
JavaScript
27 lines
653 B
JavaScript
import { createSlice } from '@reduxjs/toolkit';
|
|
|
|
const initialState = {
|
|
addItemModalVisible: false,
|
|
addProductModalVisible: false,
|
|
popupVisibility: false,
|
|
}
|
|
const toggleSlice = createSlice({
|
|
name: 'toggle',
|
|
initialState,
|
|
reducers: {
|
|
toggleVisibility: {
|
|
reducer(state, action) {
|
|
state[action.payload] = !state[action.payload];
|
|
},
|
|
prepare(toggleAction) {
|
|
return {
|
|
payload: toggleAction
|
|
}
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { toggleVisibility } = toggleSlice.actions;
|
|
|
|
export default toggleSlice.reducer; |