CreatorCenter_OOIN/src/store/slices/notificationBarSlice.js
2025-05-23 20:16:21 -04:00

30 lines
691 B
JavaScript

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