change http error toast formatting
This commit is contained in:
parent
d3e15bb9ba
commit
5edf382bcb
2 changed files with 10 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="toast" :class="color && ('border-' + color)" role="alert" ref="toast" data-autohide="false">
|
<div class="toast" :class="color && ('border-' + color)" role="alert" ref="toast" data-autohide="false">
|
||||||
<div class="toast-header">
|
<div class="toast-header" :class="[color && ('bg-' + color), color && 'text-light']">
|
||||||
<strong class="mr-auto pr-3">{{ title }}</strong>
|
<strong class="mr-auto pr-3">{{ title }}</strong>
|
||||||
<small>{{ displayTime }}</small>
|
<small>{{ displayTime }}</small>
|
||||||
<button type="button" class="ml-2 mb-1 close" @click="close()">
|
<button type="button" class="ml-2 mb-1 close" @click="close()">
|
||||||
|
|
|
@ -22,13 +22,17 @@ axios.interceptors.response.use(response => response, error => {
|
||||||
if (error.isAxiosError) {
|
if (error.isAxiosError) {
|
||||||
const message = `
|
const message = `
|
||||||
<h3>A HTTP ${error.config.method} request failed.</h3>
|
<h3>A HTTP ${error.config.method} request failed.</h3>
|
||||||
<p>url: ${error.config.url}</p>
|
<p>
|
||||||
<p>timeout: ${!!error.request.timeout}</p>
|
url: ${error.config.url}
|
||||||
<p>response-body: ${error.response && error.response.body}</p>
|
<br>
|
||||||
|
timeout: ${!!error.request.timeout}
|
||||||
|
<br>
|
||||||
|
response-body: ${error.response && error.response.body}
|
||||||
|
</p>
|
||||||
`;
|
`;
|
||||||
store.commit('createToast', {title: 'HTTP Error', message, color: 'danger'});
|
store.commit('createToast', {title: 'Error: HTTP', message, color: 'danger'});
|
||||||
} else {
|
} else {
|
||||||
store.commit('createToast', {title: 'Unknown Error', message: error.toString(), color: 'danger'});
|
store.commit('createToast', {title: 'Error: Unknown', message: error.toString(), color: 'danger'});
|
||||||
}
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue