text: import {
    LOGIN_REQUEST,
    LOGIN_SUCCESS,
    LOGIN_FAILURE,
    LOGOUT_SUCCESS,
  } from "../actions";
  
  const initialState = { loginFailure: false, isAuthenticated: false, user: {} };
  
  const authentication = (state = initialState, action) => {
    switch (action.type) {
      case LOGIN_REQUEST:
        return {
          ...state,
          loggingIn: true,
          user: action.user,
        };
      case LOGIN_SUCCESS:
        return {
          ...state,
          loginFailure: false,
          isAuthenticated: true,
          user: action.user,
        };
      case LOGIN_FAILURE:
        return {
          ...state,
          loginFailure: true,
        };
      case LOGOUT_SUCCESS:
        return {
          ...state,
          isAuthenticated: false,
          user: {},
        };
      default:
        return state;
    }
  };
  
  export default authentication;
  