1
0
mirror of https://github.com/flarum/core.git synced 2025-08-01 22:20:21 +02:00

fix: package manager failures not showing alerts (#3647)

* fix: close `LoadingModal` when install falied
* move error handler to catch
This commit is contained in:
Ngô Quốc Đạt
2022-09-23 20:11:36 +07:00
committed by GitHub
parent 7ce9d63ed6
commit 6e1bc2daed
4 changed files with 9 additions and 8 deletions

View File

@@ -64,7 +64,6 @@ export default class Installer extends Component<InstallerAttrs> {
body: {
data: this.data(),
},
errorHandler,
})
.then((response) => {
if (response.processing) {
@@ -79,8 +78,10 @@ export default class Installer extends Component<InstallerAttrs> {
window.location.reload();
}
})
.catch(errorHandler)
.finally(() => {
app.packageManager.control.setLoading(null);
app.modal.close();
m.redraw();
});
}

View File

@@ -104,7 +104,6 @@ export default class MajorUpdater<T extends MajorUpdaterAttrs = MajorUpdaterAttr
body: {
data: { dryRun },
},
errorHandler,
})
.then((response) => {
if (response?.processing) {
@@ -114,6 +113,7 @@ export default class MajorUpdater<T extends MajorUpdaterAttrs = MajorUpdaterAttr
window.location.reload();
}
})
.catch(errorHandler)
.catch((e: RequestError) => {
app.modal.close();
this.updateState.status = 'failure';

View File

@@ -47,12 +47,12 @@ export default class WhyNotModal<CustomAttrs extends WhyNotModalAttrs = WhyNotMo
package: this.attrs.package,
},
},
errorHandler,
})
.then((response) => {
this.loading = false;
this.whyNot = response.data.reason;
m.redraw();
});
})
.catch(errorHandler);
}
}

View File

@@ -94,7 +94,6 @@ export default class ControlSectionState {
.request<AsyncBackendResponse | LastUpdateCheck>({
method: 'POST',
url: `${app.forum.attribute('apiUrl')}/package-manager/check-for-updates`,
errorHandler,
})
.then((response) => {
if ((response as AsyncBackendResponse).processing) {
@@ -106,6 +105,7 @@ export default class ControlSectionState {
m.redraw();
}
})
.catch(errorHandler)
.finally(() => {
this.setLoading(null);
m.redraw();
@@ -121,7 +121,6 @@ export default class ControlSectionState {
.request<AsyncBackendResponse | null>({
method: 'POST',
url: `${app.forum.attribute('apiUrl')}/package-manager/minor-update`,
errorHandler,
})
.then((response) => {
if (response?.processing) {
@@ -131,6 +130,7 @@ export default class ControlSectionState {
window.location.reload();
}
})
.catch(errorHandler)
.finally(() => {
this.setLoading(null);
app.modal.close();
@@ -147,7 +147,6 @@ export default class ControlSectionState {
.request<AsyncBackendResponse | null>({
method: 'PATCH',
url: `${app.forum.attribute('apiUrl')}/package-manager/extensions/${extension.id}`,
errorHandler,
})
.then((response) => {
if (response?.processing) {
@@ -162,6 +161,7 @@ export default class ControlSectionState {
window.location.reload();
}
})
.catch(errorHandler)
.finally(() => {
this.setLoading(null);
app.modal.close();
@@ -177,7 +177,6 @@ export default class ControlSectionState {
.request<AsyncBackendResponse | null>({
method: 'POST',
url: `${app.forum.attribute('apiUrl')}/package-manager/global-update`,
errorHandler,
})
.then((response) => {
if (response?.processing) {
@@ -187,6 +186,7 @@ export default class ControlSectionState {
window.location.reload();
}
})
.catch(errorHandler)
.finally(() => {
this.setLoading(null);
app.modal.close();