MIF_E31222881/resources/js/Components/features/common/headerSlice.jsx

30 lines
825 B
JavaScript

import { createSlice } from '@reduxjs/toolkit'
export const headerSlice = createSlice({
name: 'header',
initialState: {
pageTitle: "Home",
noOfNotifications: 15,
newNotificationMessage: "",
newNotificationStatus: 1,
},
reducers: {
setPageTitle: (state, action) => {
state.pageTitle = action.payload
},
removeNotificationMessage: (state, action) => {
state.newNotificationMessage = ""
},
showNotification: (state, action) => {
state.newNotificationMessage = action.payload.message
state.newNotificationStatus = action.payload.status
},
}
})
export const { setPageTitle, removeNotificationMessage, showNotification } = headerSlice.actions
export default headerSlice.reducer