58 lines
1.1 KiB
TypeScript
58 lines
1.1 KiB
TypeScript
import { createReducer, on } from '@ngrx/store';
|
|
import { initialState } from './state';
|
|
import {
|
|
authSuccess,
|
|
deptSuccess,
|
|
deptUserSuccess,
|
|
deptUser,
|
|
deptUserFailure
|
|
} from './actions';
|
|
|
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
|
|
|
export const reducer = createReducer(
|
|
initialState,
|
|
on(authSuccess, (state, action) => {
|
|
return {
|
|
...state,
|
|
auth: action.res
|
|
};
|
|
}),
|
|
|
|
on(deptSuccess, (state, action) => {
|
|
return {
|
|
...state,
|
|
departmentInfoList: action.departmentInfoList
|
|
};
|
|
}),
|
|
|
|
on(deptUser, (state, action) => {
|
|
return {
|
|
...state,
|
|
selectedDepartmentProcessing: true
|
|
};
|
|
}),
|
|
|
|
on(deptUserSuccess, (state, action) => {
|
|
return {
|
|
...state,
|
|
selectedDepartmentUserInfoList: action.userInfos,
|
|
selectedDepartmentStatus: action.res,
|
|
selectedDepartmentProcessing: false
|
|
};
|
|
}),
|
|
|
|
on(deptUserFailure, (state, action) => {
|
|
return {
|
|
...state,
|
|
selectedDepartmentProcessing: false
|
|
};
|
|
}),
|
|
|
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
|
return {
|
|
...initialState
|
|
};
|
|
})
|
|
);
|