Adding retried URL in retry error logs

This commit is contained in:
David Négrier 2021-12-04 18:30:12 +01:00
parent 2cfc504e9a
commit 492fd2ed4e

View File

@ -15,19 +15,19 @@ axiosWithRetry.defaults.raxConfig = {
// You can detect when a retry is happening, and figure out how many // You can detect when a retry is happening, and figure out how many
// retry attempts have been made // retry attempts have been made
onRetryAttempt: err => { onRetryAttempt: (err) => {
const cfg = rax.getConfig(err); const cfg = rax.getConfig(err);
console.log(err) console.log(err);
console.log(cfg) console.log(cfg);
console.log(`Retry attempt #${cfg?.currentRetryAttempt}`); console.log(`Retry attempt #${cfg?.currentRetryAttempt} on URL '${err.config.url}'`);
errorStore.addErrorMessage('Unable to connect to WorkAdventure. Are you connected to internet?', { errorStore.addErrorMessage("Unable to connect to WorkAdventure. Are you connected to internet?", {
closable: false, closable: false,
id: "axios_retry" id: "axios_retry",
}); });
}, },
}; };
axiosWithRetry.interceptors.response.use(res => { axiosWithRetry.interceptors.response.use((res) => {
if (res.status < 400) { if (res.status < 400) {
errorStore.clearMessageById("axios_retry"); errorStore.clearMessageById("axios_retry");
} }