added employee folder redux

This commit is contained in:
jfrye122
2023-04-13 13:33:12 -04:00
parent d8d8ca0d11
commit 35573417c4
5 changed files with 136 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import EmployeeActionTypes from "./employee.types";
const INITIAL_STATE = {
currentEmployee: {
authorized: null,
},
employeeSigningIn: false,
error: null,
};
const employeeReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case EmployeeActionTypes.SIGN_IN_EMPLOYEE_START:
return {
...state,
employeeSigningIn: true,
error: null,
};
case EmployeeActionTypes.SIGN_IN_EMPLOYEE_SUCCESS:
return {
...state,
currentEmployee: action.payload,
error: null,
};
case EmployeeActionTypes.SIGN_OUT_EMPLOYEE_SUCCESS:
return {
...state,
currentEmployee: { authorized: false },
error: null,
};
default:
return state;
}
};
export default employeeReducer;