로그인 시에만 메일, 결재 뱃지 카운트 하도록 수정.
This commit is contained in:
parent
3e26df05c3
commit
62033f3f90
|
@ -29,7 +29,6 @@ import {
|
||||||
KEY_URL_INFO,
|
KEY_URL_INFO,
|
||||||
LoginInfo,
|
LoginInfo,
|
||||||
KEY_LOGIN_INFO,
|
KEY_LOGIN_INFO,
|
||||||
KEY_LOGIN_RES_INFO,
|
|
||||||
KEY_VER_INFO
|
KEY_VER_INFO
|
||||||
} from '@app/types';
|
} from '@app/types';
|
||||||
import {
|
import {
|
||||||
|
@ -100,7 +99,6 @@ export class TopBarComponent implements OnInit, OnDestroy {
|
||||||
private sessionStorageService: SessionStorageService,
|
private sessionStorageService: SessionStorageService,
|
||||||
private daesangApiService: DaesangApiService,
|
private daesangApiService: DaesangApiService,
|
||||||
private daesangProtocolService: DaesangProtocolService,
|
private daesangProtocolService: DaesangProtocolService,
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
|
||||||
@Inject(DOCUMENT) private document: Document,
|
@Inject(DOCUMENT) private document: Document,
|
||||||
private logger: NGXLogger
|
private logger: NGXLogger
|
||||||
) {}
|
) {}
|
||||||
|
@ -123,7 +121,7 @@ export class TopBarComponent implements OnInit, OnDestroy {
|
||||||
>(KEY_VER_INFO);
|
>(KEY_VER_INFO);
|
||||||
|
|
||||||
// WebLink init..
|
// WebLink init..
|
||||||
this.initWebLink();
|
this.initWebLink(loginRes);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
@ -161,85 +159,83 @@ export class TopBarComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initWebLink(): void {
|
initWebLink(loginRes: LoginResponse): void {
|
||||||
const loginRes = this.sessionStorageService.get<LoginResponse>(
|
if (!!loginRes) {
|
||||||
KEY_LOGIN_RES_INFO
|
const urlInfo: DaesangUrlInfoResponse = this.sessionStorageService.get<
|
||||||
);
|
DaesangUrlInfoResponse
|
||||||
|
>(KEY_URL_INFO);
|
||||||
|
|
||||||
const urlInfo: DaesangUrlInfoResponse = this.sessionStorageService.get<
|
if (!!urlInfo && !!urlInfo.webLink) {
|
||||||
DaesangUrlInfoResponse
|
// order by webLinkAllowedList..
|
||||||
>(KEY_URL_INFO);
|
this.weblink = urlInfo.webLinkAllowedList.map(showWeblink =>
|
||||||
|
urlInfo.webLink.find(weblink => weblink.key === showWeblink)
|
||||||
if (!!urlInfo && !!urlInfo.webLink) {
|
|
||||||
// order by webLinkAllowedList..
|
|
||||||
this.weblink = urlInfo.webLinkAllowedList.map(showWeblink =>
|
|
||||||
urlInfo.webLink.find(weblink => weblink.key === showWeblink)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (urlInfo.webLinkAllowedList.indexOf(WebLinkType.Mail) > -1) {
|
|
||||||
// 메일 카운트 체크.
|
|
||||||
const link = urlInfo.webLink.filter(
|
|
||||||
weblink => weblink.key === WebLinkType.MailCnt
|
|
||||||
);
|
);
|
||||||
if (link.length > 0) {
|
|
||||||
const appUserInfo = this.localStorageService.encGet<AppUserInfo>(
|
if (urlInfo.webLinkAllowedList.indexOf(WebLinkType.Mail) > -1) {
|
||||||
KEY_APP_USER_INFO,
|
// 메일 카운트 체크.
|
||||||
environment.customConfig.appKey
|
const link = urlInfo.webLink.filter(
|
||||||
|
weblink => weblink.key === WebLinkType.MailCnt
|
||||||
);
|
);
|
||||||
|
if (link.length > 0) {
|
||||||
|
const appUserInfo = this.localStorageService.encGet<AppUserInfo>(
|
||||||
|
KEY_APP_USER_INFO,
|
||||||
|
environment.customConfig.appKey
|
||||||
|
);
|
||||||
|
|
||||||
const WebLinkMailCnt = link[0];
|
const WebLinkMailCnt = link[0];
|
||||||
const loginPw = appUserInfo.loginPw;
|
const loginPw = appUserInfo.loginPw;
|
||||||
const loginPw2 = this.loginInfo.loginPw;
|
const loginPw2 = this.loginInfo.loginPw;
|
||||||
const loginId = this.loginInfo.loginId;
|
const loginId = this.loginInfo.loginId;
|
||||||
const token = loginRes.tokenString;
|
const token = loginRes.tokenString;
|
||||||
|
|
||||||
const url = WebLinkMailCnt.url
|
const url = WebLinkMailCnt.url
|
||||||
.replace(/(\(%USER_TOKEN%\))/g, token)
|
.replace(/(\(%USER_TOKEN%\))/g, token)
|
||||||
.replace(/(\(%USER_ID%\))/g, loginId)
|
.replace(/(\(%USER_ID%\))/g, loginId)
|
||||||
.replace(/(\(%USER_PASS%\))/g, loginPw);
|
.replace(/(\(%USER_PASS%\))/g, loginPw);
|
||||||
|
|
||||||
this.daesangApiService
|
this.daesangApiService
|
||||||
.retrieveMailCount(url)
|
.retrieveMailCount(url)
|
||||||
.pipe(
|
.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map(res => (this.webLinkBadgeMail = res.count)),
|
map(res => (this.webLinkBadgeMail = res.count)),
|
||||||
catchError(error => of(this.logger.log(error)))
|
catchError(error => of(this.logger.log(error)))
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (urlInfo.webLinkAllowedList.indexOf(WebLinkType.Payment) > -1) {
|
||||||
if (urlInfo.webLinkAllowedList.indexOf(WebLinkType.Payment) > -1) {
|
// 결제 카운트 체크.
|
||||||
// 결제 카운트 체크.
|
const link = urlInfo.webLink.filter(
|
||||||
const link = urlInfo.webLink.filter(
|
weblink => weblink.key === WebLinkType.PaymentCnt
|
||||||
weblink => weblink.key === WebLinkType.PaymentCnt
|
|
||||||
);
|
|
||||||
if (link.length > 0) {
|
|
||||||
const appUserInfo = this.localStorageService.encGet<AppUserInfo>(
|
|
||||||
KEY_APP_USER_INFO,
|
|
||||||
environment.customConfig.appKey
|
|
||||||
);
|
);
|
||||||
|
if (link.length > 0) {
|
||||||
|
const appUserInfo = this.localStorageService.encGet<AppUserInfo>(
|
||||||
|
KEY_APP_USER_INFO,
|
||||||
|
environment.customConfig.appKey
|
||||||
|
);
|
||||||
|
|
||||||
const WebLinkPaymentCnt = link[0];
|
const WebLinkPaymentCnt = link[0];
|
||||||
const loginPw = appUserInfo.loginPw;
|
const loginPw = appUserInfo.loginPw;
|
||||||
const loginPw2 = this.loginInfo.loginPw;
|
const loginPw2 = this.loginInfo.loginPw;
|
||||||
const loginId = this.loginInfo.loginId;
|
const loginId = this.loginInfo.loginId;
|
||||||
const token = loginRes.tokenString;
|
const token = loginRes.tokenString;
|
||||||
|
|
||||||
const url = WebLinkPaymentCnt.url
|
const url = WebLinkPaymentCnt.url
|
||||||
.replace(/(\(%USER_TOKEN%\))/g, token)
|
.replace(/(\(%USER_TOKEN%\))/g, token)
|
||||||
.replace(/(\(%USER_ID%\))/g, loginId)
|
.replace(/(\(%USER_ID%\))/g, loginId)
|
||||||
.replace(/(\(%USER_PASS%\))/g, loginPw);
|
.replace(/(\(%USER_PASS%\))/g, loginPw);
|
||||||
|
|
||||||
this.daesangApiService
|
this.daesangApiService
|
||||||
.retrievePaymentCount(url)
|
.retrievePaymentCount(url)
|
||||||
.pipe(
|
.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map(res => {
|
map(res => {
|
||||||
this.webLinkBadgePayment = res.count;
|
this.webLinkBadgePayment = res.count;
|
||||||
}),
|
}),
|
||||||
catchError(error => of(this.logger.log(error)))
|
catchError(error => of(this.logger.log(error)))
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user