showing error response in response tab instead of alert message

This commit is contained in:
therealrinku
2023-10-09 12:33:10 +05:45
parent 159dd90b03
commit fdca86ffd2
3 changed files with 19 additions and 13 deletions

View File

@@ -117,22 +117,23 @@ export const sendRequest = (item, collectionUid) => (dispatch, getState) => {
})
.then(resolve)
.catch((err) => {
const errorMessage = err.message ?? 'Something went wrong';
const errorResponse = {
status: 'Error',
isError: true,
error: errorMessage,
size: '0',
duration: '0'
};
dispatch(
responseReceived({
itemUid: item.uid,
collectionUid: collectionUid,
response: null
response: errorResponse
})
);
if (err && err.message === "Error invoking remote method 'send-http-request': Error: Request cancelled") {
console.log('>> request cancelled');
return;
}
console.log('>> sending request failed');
console.log(err);
toast.error(err ? err.message : 'Something went wrong!');
});
});
};