store bugfix

This commit is contained in:
leejinho 2020-03-05 16:13:11 +09:00
parent bf351bf690
commit e8bb32b609
3 changed files with 18 additions and 62 deletions

View File

@ -69,12 +69,6 @@ export const deptUserFailure = createAction(
props<{ error: any }>()
);
/** 내 부서 조회 */
export const selectedMyDept = createAction(
'[Messenger::Query] selected Department on tree',
props<SelectedDept>()
);
export const myDeptUser = createAction(
'[Messenger::Query] My Dept User',
props<DeptUserRequest>()

View File

@ -26,7 +26,6 @@ import {
selectedDept,
deptUserFailure,
selectedDeptSuccess,
selectedMyDept,
searchDeptUser,
searchDeptUserSuccess,
cancelSearchDeptUser
@ -104,9 +103,10 @@ export class Effects {
)
),
switchMap(([req, loginResInfo]) => {
const isMyDept = req.seq === loginResInfo.departmentCode;
return this.organizationService
.getDeptUser({
divCd: 'ORG',
divCd: 'ORG' + (isMyDept ? '_MY' : ''),
companyCode: loginResInfo.companyCode,
seq: req.seq,
search: '',
@ -124,6 +124,13 @@ export class Effects {
})
);
if (!!isMyDept) {
this.store.dispatch(
myDeptUserSuccess({
userInfos
})
);
} else {
// 검색 결과에 따른 프레즌스 조회.
const userSeqList: number[] = [];
userInfos.map(user => userSeqList.push(user.seq));
@ -135,6 +142,7 @@ export class Effects {
})
);
}
}
this.store.dispatch(selectedDeptSuccess({}));
}),
@ -145,53 +153,7 @@ export class Effects {
},
{ dispatch: false }
);
selectedMyDept$ = createEffect(
() => {
return this.actions$.pipe(
ofType(selectedMyDept),
withLatestFrom(
this.store.pipe(
select(
(state: any) =>
state.account.authentication.loginRes as LoginResponse
)
)
),
switchMap(([req, loginResInfo]) => {
return this.organizationService
.getDeptUser({
divCd: 'ORG_MY',
companyCode: loginResInfo.companyCode,
seq: req.seq,
search: '',
searchRange: DeptSearchType.All,
senderCompanyCode: loginResInfo.companyCode,
senderEmployeeType: loginResInfo.userInfo.employeeType
})
.pipe(
map(datas => {
const userInfos: UserInfoSS[] = datas.userInfos;
this.store.dispatch(
deptUserSuccess({
userInfos
})
);
this.store.dispatch(
myDeptUserSuccess({
userInfos
})
);
this.store.dispatch(selectedDeptSuccess({}));
}),
catchError(error => of(myDeptUserFailure({ error })))
);
})
);
},
{ dispatch: false }
);
searchDeptUser$ = createEffect(
() => {
return this.actions$.pipe(

View File

@ -57,7 +57,7 @@ export function selectors<S>(selector: Selector<any, State>) {
),
departmentUserInfoList: createSelector(
selector,
(state: State) => state.myDepartmentUserInfoList
(state: State) => state.departmentUserInfoList
),
myDepartmentUserInfoList: createSelector(
selector,