Files
bodyshop/client/src/redux/tech/tech.reducer.js
2020-06-29 15:24:04 -07:00

39 lines
824 B
JavaScript

import TechActionTypes from "./tech.types";
const INITIAL_STATE = {
technician: null,
loginLoading: false,
loginError: null,
};
const applicationReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case TechActionTypes.TECH_LOGOUT:
return {
...state,
technician: null,
};
case TechActionTypes.TECH_LOGIN_START:
return {
...state,
loginLoading: true,
};
case TechActionTypes.TECH_LOGIN_SUCCESS:
return {
...state,
technician: action.payload,
loginLoading: false,
};
case TechActionTypes.TECH_LOGIN_FAILURE:
return {
...state,
loginError: action.payload,
loginLoading: false,
};
default:
return state;
}
};
export default applicationReducer;