mirror of
https://github.com/flarum/framework.git
synced 2025-01-31 19:33:16 +08:00
Fix handling of non-409 errors in ExtensionsPage
If the error isn't a 409, we'll want to re-throw the error so it'll be handled by the default system (showing an alert). For simplicity, we can also move 409-handling logic out of setTimeout. Finally, we adjust the timeout to 300 milliseconds to match the modal transition animation length.
This commit is contained in:
parent
95682d1e92
commit
c7d496446b
|
@ -139,8 +139,13 @@ export default class ExtensionsPage extends Page {
|
||||||
// TODO: This workaround should be removed when we move away from bootstrap JS for modals.
|
// TODO: This workaround should be removed when we move away from bootstrap JS for modals.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
app.modal.close();
|
app.modal.close();
|
||||||
|
}, 300); // Bootstrap's Modal.TRANSITION_DURATION is 300 ms.
|
||||||
|
|
||||||
const error = JSON.parse(e.responseText).errors[0];
|
if (e.status !== 409) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
const error = e.response.errors[0];
|
||||||
|
|
||||||
app.alerts.show(
|
app.alerts.show(
|
||||||
{ type: 'error' },
|
{ type: 'error' },
|
||||||
|
@ -149,6 +154,5 @@ export default class ExtensionsPage extends Page {
|
||||||
extensions: error.extensions.join(', '),
|
extensions: error.extensions.join(', '),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}, 250);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user