RequestManager make requests abortable - Fix missed usages (#318)

This commit is contained in:
schroda
2023-05-23 13:54:14 +02:00
committed by GitHub
parent c32cb53592
commit 606ee9de2d
4 changed files with 8 additions and 8 deletions

View File

@@ -87,13 +87,13 @@ export default function ExtensionCard(props: IProps) {
setInstalledState(state); setInstalledState(state);
switch (action) { switch (action) {
case ExtensionAction.INSTALL: case ExtensionAction.INSTALL:
await requestManager.installExtension(pkgName); await requestManager.installExtension(pkgName).response;
break; break;
case ExtensionAction.UNINSTALL: case ExtensionAction.UNINSTALL:
await requestManager.uninstallExtension(pkgName); await requestManager.uninstallExtension(pkgName).response;
break; break;
case ExtensionAction.UPDATE: case ExtensionAction.UPDATE:
await requestManager.updateExtension(pkgName); await requestManager.updateExtension(pkgName).response;
break; break;
default: default:
throw new Error(`Unexpected ExtensionAction "${action}"`); throw new Error(`Unexpected ExtensionAction "${action}"`);

View File

@@ -46,7 +46,7 @@ function UpdateChecker({ handleFinishedUpdate }: IUpdateCheckerProps) {
try { try {
setLoading(true); setLoading(true);
setProgress(0); setProgress(0);
await requestManager.startGlobalUpdate(); await requestManager.startGlobalUpdate().response;
} catch (e) { } catch (e) {
makeToast(t('global.error.label.update_failed'), 'error'); makeToast(t('global.error.label.update_failed'), 'error');
setLoading(false); setLoading(false);

View File

@@ -67,15 +67,15 @@ const DownloadQueue: React.FC = () => {
try { try {
if (isRunning) { if (isRunning) {
// required to stop before deleting otherwise the download kept going. Server issue? // required to stop before deleting otherwise the download kept going. Server issue?
await requestManager.stopDownloads(); await requestManager.stopDownloads().response;
} }
await Promise.all([ await Promise.all([
// remove from download queue // remove from download queue
requestManager.removeChapterFromDownloadQueue(chapter.mangaId, chapter.index), requestManager.removeChapterFromDownloadQueue(chapter.mangaId, chapter.index).response,
// delete partial download, should be handle server side? // delete partial download, should be handle server side?
// bug: The folder and the last image downloaded are not deleted // bug: The folder and the last image downloaded are not deleted
requestManager.deleteDownloadedChapter(chapter.mangaId, chapter.index), requestManager.deleteDownloadedChapter(chapter.mangaId, chapter.index).response,
]); ]);
} catch (error) { } catch (error) {
makeToast(t('download.queue.error.label.failed_to_remove'), 'error'); makeToast(t('download.queue.error.label.failed_to_remove'), 'error');

View File

@@ -111,7 +111,7 @@ export default function LibrarySettings() {
); );
const updateCategory = (category: ICategory) => const updateCategory = (category: ICategory) =>
requestManager.updateCategory(category.id, { includeInUpdate: category.includeInUpdate }); requestManager.updateCategory(category.id, { includeInUpdate: category.includeInUpdate }).response;
const updateCategories = async () => { const updateCategories = async () => {
const categoriesToUpdate = dialogCategories.filter((category) => { const categoriesToUpdate = dialogCategories.filter((category) => {