mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
Improve api error dialog
This commit is contained in:
parent
2d26ebb041
commit
18ea1d88db
1 changed files with 6 additions and 1 deletions
|
@ -70,7 +70,12 @@ export function apiWithDialog(
|
|||
onFailure?: (e: Error) => void,
|
||||
) {
|
||||
const promise = api(endpoint, data, token);
|
||||
promiseDialog(promise, onSuccess, onFailure);
|
||||
promiseDialog(promise, onSuccess, onFailure ? onFailure : (e) => {
|
||||
dialog({
|
||||
type: 'error',
|
||||
text: e.message + '\n' + (e as any).id,
|
||||
});
|
||||
});
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue