text: import {
    UPDATE_CLEANING_LOG_ATTEMPT,
    UPDATE_CLEANING_LOG_SUCCESS,
    UPDATE_CLEANING_LOG_FAIL,
  } from '../ActionTypes';
  
  const initialState = {
    loading: false,
    error: false,
    errorMessage: '',
    success: false,
  };
  
  const reducer = (state = initialState, action) => {
    switch (action.type) {
      case UPDATE_CLEANING_LOG_ATTEMPT: {
        return {
          ...state,
          loading: true,
          error: false,
          errorMessage: '',
          success: false,
        };
      }
      case UPDATE_CLEANING_LOG_SUCCESS: {
        return {
          ...state,
          loading: false,
          error: false,
          errorMessage: '',
          success: true,
        };
      }
      case UPDATE_CLEANING_LOG_FAIL: {
        const { message } = action.payload;
        return {
          ...state,
          loading: false,
          error: true,
          errorMessage: message,
          success: false,
        };
      }
      default: {
        return state;
      }
    }
  };
  
  export default reducer;
  