mirror of
https://github.com/Funkoala14/CreatorCenter_OOIN.git
synced 2025-06-09 08:58:14 +08:00
30 lines
691 B
JavaScript
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;
|