import { createSlice } from '@reduxjs/toolkit';

const initialState = {
  overallFailure: false,
  popup: false,
  message: '',
  updatedAt: null,
  updatedBy: null,

  isLoading: true,
};

export const slice = createSlice({
  name: '@@NOTIFICATIONS',
  initialState,
  reducers: {
    setAction: (state, action) => {
      Object.keys(action.payload).forEach((key) => {
        state[key] = action.payload[key];
      });
    },
    getItemAction: (state) => state,
    saveItemAction: (state) => state,
  },
});

export const { setAction, getItemAction, saveItemAction } = slice.actions;
