Assume that your state structure looks like this:
const initialState = {
DateSucess: ' ',
DateFailure: ' '
}
Well then, with that state, now we write a reducer and..
The reducer is a pure function that takes the previous state and an
action, and returns the next state.
In the reducer, we make some calculation and return the next state. Keeping in mind that, we don't mutate the state. We create a copy with Object.assign().
Object.assign(state, { DateSucess: action.payload}) is also wrong: it will mutate the first argument. You must supply an empty object as the first parameter. Like this:
return Object.assign({}, state, { DateSucess: action.payload})
You can also enable the object spread operator proposal to write { ...state, ...newState } instead. In your case, it will look like:
return {...state, DateSucess: action.payload}
For more information: https://redux.js.org/basics/reducers