Improve api error dialog
This commit is contained in:
parent
1df7abfbb9
commit
a15299ae53
|
@ -70,7 +70,12 @@ export function apiWithDialog(
|
||||||
onFailure?: (e: Error) => void,
|
onFailure?: (e: Error) => void,
|
||||||
) {
|
) {
|
||||||
const promise = api(endpoint, data, token);
|
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;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue