added employee folder redux
This commit is contained in:
36
redux/employee/employee.reducer.js
Normal file
36
redux/employee/employee.reducer.js
Normal 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;
|
||||
Reference in New Issue
Block a user