메일 카운트 5분마다 갱신하도록 수정.

This commit is contained in:
leejinho 2020-03-23 17:15:48 +09:00
parent 23ae97caab
commit 2b4846d865

View File

@ -117,6 +117,8 @@ export class TopBarComponent implements OnInit, OnDestroy {
webLinkBadgeMail = 0;
webLinkBadgePayment = 0;
webLinkbadgeEmailCountInterval: any;
appVersion: string;
WebLinkType = WebLinkType;
@ -221,6 +223,10 @@ export class TopBarComponent implements OnInit, OnDestroy {
this.zoomSubscription.unsubscribe();
this.zoomSubscription = undefined;
}
if (!!this.webLinkbadgeEmailCountInterval) {
clearInterval(this.webLinkbadgeEmailCountInterval);
}
}
initWebLink(loginRes: LoginResponse): void {
@ -262,14 +268,18 @@ export class TopBarComponent implements OnInit, OnDestroy {
.replace(/(\(%USER_ID%\))/g, loginId)
.replace(/(\(%USER_PASS%\))/g, loginPw);
this.daesangApiService
.retrieveMailCount(url)
.pipe(
take(1),
map(res => (this.webLinkBadgeMail = res.count)),
catchError(error => of(this.logger.log(error)))
)
.subscribe();
if (!this.webLinkbadgeEmailCountInterval) {
this.webLinkbadgeEmailCountInterval = setInterval(() => {
this.daesangApiService
.retrieveMailCount(url)
.pipe(
take(1),
map(res => (this.webLinkBadgeMail = res.count)),
catchError(error => of(this.logger.log(error)))
)
.subscribe();
}, 5 * 60 * 1000);
}
}
}
if (urlInfo.webLinkAllowedList.indexOf(WebLinkType.Payment) > -1) {