UNPKG

nexus-react-core

Version:

A comprehensive React toolkit with services, hooks, and Redux store management

38 lines 1.43 kB
"use strict"; var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.setLoading = exports.hideNotification = exports.showErrorNotification = exports.showSuccessNotification = void 0; const toolkit_1 = require("@reduxjs/toolkit"); const initialState = { showSuccess: false, showError: false, message: "", isLoading: false, }; const notificationSlice = (0, toolkit_1.createSlice)({ name: "notifications", initialState, reducers: { showSuccessNotification: (state, action) => { state.showSuccess = true; state.showError = false; state.message = action.payload; }, showErrorNotification: (state, action) => { state.showSuccess = false; state.showError = true; state.message = action.payload; }, hideNotification: (state) => { state.showSuccess = false; state.showError = false; state.message = ""; }, setLoading: (state, action) => { state.isLoading = action.payload; }, }, }); _a = notificationSlice.actions, exports.showSuccessNotification = _a.showSuccessNotification, exports.showErrorNotification = _a.showErrorNotification, exports.hideNotification = _a.hideNotification, exports.setLoading = _a.setLoading; exports.default = notificationSlice.reducer; //# sourceMappingURL=slice.js.map