2019-09-25 08:26:19 +00:00
|
|
|
import { createReducer, on } from '@ngrx/store';
|
|
|
|
import { initialState } from './state';
|
2019-10-07 04:07:52 +00:00
|
|
|
import { authSuccess, deptSuccess, deptUserSuccess } from './actions';
|
2019-09-25 08:26:19 +00:00
|
|
|
|
2019-10-11 04:11:48 +00:00
|
|
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
|
|
|
|
2019-09-25 08:26:19 +00:00
|
|
|
export const reducer = createReducer(
|
|
|
|
initialState,
|
|
|
|
on(authSuccess, (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
auth: action.res
|
|
|
|
};
|
2019-10-04 04:45:02 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
on(deptSuccess, (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
departmentInfoList: action.departmentInfoList
|
|
|
|
};
|
2019-10-07 04:07:52 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
on(deptUserSuccess, (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
selectedDepartmentUserInfoList: action.userInfos,
|
|
|
|
selectedDepartmentStatus: action.res
|
|
|
|
};
|
2019-10-11 04:11:48 +00:00
|
|
|
}),
|
|
|
|
on(AuthenticationStore.logout, (state, action) => {
|
|
|
|
return {
|
|
|
|
...initialState
|
|
|
|
};
|
2019-09-25 08:26:19 +00:00
|
|
|
})
|
|
|
|
);
|