aboutsummaryrefslogtreecommitdiff
path: root/src/site/layouts
diff options
context:
space:
mode:
authorPitu <[email protected]>2019-03-29 03:28:25 +0000
committerPitu <[email protected]>2019-03-29 03:28:25 +0000
commita248f69947b0a211fd1288c5ad389ba62334ec3f (patch)
treedcf50649cece230ea4a4b3403ddb1b518509dead /src/site/layouts
parentAdd flexsearch (diff)
downloadhost.fuwn.me-a248f69947b0a211fd1288c5ad389ba62334ec3f.tar.xz
host.fuwn.me-a248f69947b0a211fd1288c5ad389ba62334ec3f.zip
Tody up a little bit
Diffstat (limited to 'src/site/layouts')
-rw-r--r--src/site/layouts/default.vue30
1 files changed, 7 insertions, 23 deletions
diff --git a/src/site/layouts/default.vue b/src/site/layouts/default.vue
index a251e7c..8ee9140 100644
--- a/src/site/layouts/default.vue
+++ b/src/site/layouts/default.vue
@@ -14,38 +14,22 @@ export default {
},
created() {
Vue.prototype.$onPromiseError = (error, logout = false) => {
- this.processCatch(error, logout);
+ if (error.response && error.response.data && error.response.data.message) {
+ this.showToast(error.response.data.message, true, 5000);
+ } else {
+ console.error(error);
+ this.showToast('Something went wrong, please check the console :(', true, 5000);
+ }
};
Vue.prototype.$showToast = (text, error, duration) => {
- this.showToast(text, error, duration);
- };
- },
- methods: {
- showToast(text, error, duration) {
this.$toast.open({
duration: duration || 2500,
message: text,
position: 'is-bottom',
type: error ? 'is-danger' : 'is-success'
});
- },
- processCatch(error, logout) {
- if (error.response && error.response.data && error.response.data.message) {
- this.showToast(error.response.data.message, true, 5000);
- /*
- if (error.response.status === 429) return;
- if (error.response.status === 502) return;
- if (error.response.data.message === 'Token expired') {
- this.$logOut();
- setTimeout(() => this.$router.push('/'), 3000);
- }
- */
- } else {
- console.error(error);
- this.showToast('Something went wrong, please check the console :(', true, 5000);
- }
- }
+ };
}
};
</script>