const initialState = { message: '', show: false, type: 'success', // success, warning, error, info }; const notificationBarSlice = createSlice({ name: 'notificationBar', initialState, reducers: { setNotificationBarMessage: (state, action) => { state.message = action.payload; }, setNotificationBarShow: (state, action) => { state.show = action.payload; }, resetNotificationBar: (state) => { state.message = ''; state.show = false; state.type = 'success'; }, }, }); export const { setNotificationBarMessage, setNotificationBarShow, resetNotificationBar } = notificationBarSlice.actions; export default notificationBarSlice.reducer;