Рефакторинг

This commit is contained in:
Book Pauk
2022-10-26 01:48:14 +07:00
parent d579be5376
commit ed4313b77b
2 changed files with 16 additions and 20 deletions

View File

@@ -409,18 +409,18 @@ class AuthorList extends BaseList {
return;
this.refreshing = true;
(async() => {
await utils.sleep(500);
if (this.refreshing)
this.loadingMessage = 'Поиск серий...';
})();
try {
while (this.queryExecute) {
const query = this.queryExecute;
this.queryExecute = null;
let inSearch = true;
(async() => {
await utils.sleep(500);
if (inSearch)
this.loadingMessage = 'Поиск авторов...';
})();
try {
const result = await this.api.authorSearch(query);
@@ -438,13 +438,11 @@ class AuthorList extends BaseList {
}
} catch (e) {
this.$root.stdDialog.alert(e.message, 'Ошибка');
} finally {
inSearch = false;
this.loadingMessage = '';
}
}
} finally {
this.refreshing = false;
this.loadingMessage = '';
}
}
}

View File

@@ -241,18 +241,18 @@ class SeriesList extends BaseList {
return;
this.refreshing = true;
(async() => {
await utils.sleep(500);
if (this.refreshing)
this.loadingMessage = 'Поиск серий...';
})();
try {
while (this.queryExecute) {
const query = this.queryExecute;
this.queryExecute = null;
let inSearch = true;
(async() => {
await utils.sleep(500);
if (inSearch)
this.loadingMessage = 'Поиск серий...';
})();
try {
const result = await this.api.seriesSearch(query);
@@ -270,13 +270,11 @@ class SeriesList extends BaseList {
}
} catch (e) {
this.$root.stdDialog.alert(e.message, 'Ошибка');
} finally {
inSearch = false;
this.loadingMessage = '';
}
}
} finally {
this.refreshing = false;
this.loadingMessage = '';
}
}
}