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

const initialState = {
  lastUpdate: null,
};

export const slice = createSlice({
  name: '@@COMMON/INIT',
  initialState,

  reducers: {
    initEventAction: (state) => state,
    requestEventAction: (state) => state,
    responseEventAction: (state) => state,
    errorEventAction: (state) => state,
    lastUpdateAction: (state, action) => {
      state.lastUpdate = action.payload || initialState.lastUpdate;
    },
  },
});

export const { errorEventAction, initEventAction, lastUpdateAction, requestEventAction, responseEventAction } =
  slice.actions;

export default slice.reducer;
