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