updated getting rates in reducer

This commit is contained in:
jfrye122
2023-05-05 10:46:22 -04:00
parent 4b084a8789
commit 7d1ad43f06

View File

@@ -7,6 +7,7 @@ const INITIAL_STATE = {
rates:[],
},
signingIn: false,
gettingRates: false,
error: null,
};
@@ -33,14 +34,28 @@ const employeeReducer = (state = INITIAL_STATE, action) => {
case EmployeeActionTypes.EMPLOYEE_SIGN_OUT:
return {
...state,
currentEmployee: { authorized: false, technician:null },
currentEmployee: { authorized: false, technician:null },//TODO check if this needs to do clean up like set loaders all to false
error: null,
};
case EmployeeActionTypes.SET_CAMERA_JOB:
case EmployeeActionTypes.EMPLOYEE_GET_RATES_START:
return {
...state,
currentEmployee: { rates:action.payload },
gettingRates: true,
};
case EmployeeActionTypes.EMPLOYEE_GET_RATES_SUCCESS:
return {
...state,
//currentEmployee: { authorized: true, technician:action.payload },
currentEmployee: { rates:action.payload },//TODO check if ...state needed
gettingRates: false,
error: null,
};
case EmployeeActionTypes.EMPLOYEE_GET_RATES_FAILURE:
return {
...state,
gettingRates: false,
error: action.payload,
};
default:
return state;