reworked processing

This commit is contained in:
Timo 2020-12-03 23:11:59 +02:00
parent b877a1888f
commit 60b4cfa033

View File

@ -167,7 +167,6 @@ export class DictionaryOverviewScreenComponent {
}
async saveEntries() {
this.processing = true;
let entriesToAdd = [];
this.currentDictionaryEntries.forEach((currentEntry) => {
entriesToAdd.push(currentEntry);
@ -176,9 +175,9 @@ export class DictionaryOverviewScreenComponent {
entriesToAdd = entriesToAdd.filter((e) => e && e.trim().length > 0).map((e) => e.trim());
const invalidRowsExist = entriesToAdd.filter((e) => e.length < DictionaryOverviewScreenComponent.MIN_WORD_LENGTH);
if (invalidRowsExist.length === 0) {
// can add at least 1
// can add at least 1 - block UI
this.processing = true;
let obs: Observable<any>;
console.log('entriesToAdd', entriesToAdd, this);
if (entriesToAdd.length > 0) {
obs = this._dictionaryControllerService.addEntry(entriesToAdd, this.dictionary.type, true);
} else {
@ -195,6 +194,7 @@ export class DictionaryOverviewScreenComponent {
);
},
() => {
this.processing = false;
this._notificationService.showToastNotification(
this._translateService.instant('dictionary-overview.error.generic'),
null,