From 8ae34e2829eed64779e272a4f1603fced2bc10ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Glasn=C3=A1k?= Date: Wed, 8 Nov 2023 17:40:30 +0100 Subject: [PATCH] [Toast] Added error parsing global function --- app/src/plugins/lib@auth/login/_components/a-login-form.vue | 2 +- app/src/plugins/w/toast/index.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/plugins/lib@auth/login/_components/a-login-form.vue b/app/src/plugins/lib@auth/login/_components/a-login-form.vue index 0d666a9..f292665 100644 --- a/app/src/plugins/lib@auth/login/_components/a-login-form.vue +++ b/app/src/plugins/lib@auth/login/_components/a-login-form.vue @@ -49,7 +49,7 @@ export default { await this.$store.dispatch('auth/login', this.form) this.$router.push({ name: 'Dashboard - Tasks'}) } catch (error) { - this.$toast.error(error?.response?.data?.message || error) + this.$toast.error(this.$parseError(error)) } } } diff --git a/app/src/plugins/w/toast/index.ts b/app/src/plugins/w/toast/index.ts index 7066825..d63e244 100644 --- a/app/src/plugins/w/toast/index.ts +++ b/app/src/plugins/w/toast/index.ts @@ -10,5 +10,6 @@ export default { app.use(VueToast) // app.config.globalProperties.$wToast = new Toast() + app.config.globalProperties.$parseError = (error) => error?.data?.message || error?.response?.data?.message || error?.message || error } } \ No newline at end of file