bug fixed

This commit is contained in:
richard-loafle 2020-02-12 13:58:15 +09:00
parent 45046d57f3
commit 2a05ada4c5

View File

@ -24,7 +24,8 @@ import {
combineLatest,
Subscription,
of,
BehaviorSubject
BehaviorSubject,
forkJoin
} from 'rxjs';
import { map, tap, catchError, take } from 'rxjs/operators';
@ -138,23 +139,29 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
const currentLang = this.translateService.currentLang;
const langs = ['ko', 'en'];
const translationObservables: Observable<any>[] = [];
langs.forEach(lang => {
this.translateService
.getTranslation(lang)
.pipe(take(1))
.subscribe(
translation => {
translationObservables.push(this.translateService.getTranslation(lang));
});
forkJoin(translationObservables)
.pipe(take(1))
.subscribe(
translations => {
for (const translation of translations) {
banKeys.forEach(banKey => {
this.bannedWords.push(
this.translateParser.getValue(translation, banKey)
);
});
},
error => {},
() => {}
);
});
}
},
error => {},
() => {
this.translateService.use(currentLang);
}
);
}
currentTabIndex: number;