From 91929df865793fcf63b4f53792493f47b3a9e31d Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Thu, 22 Aug 2019 16:24:07 +0800 Subject: [PATCH 1/2] [-] Remove unnecessary event call --- src/components/login/login.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/login/login.ts b/src/components/login/login.ts index 114fa0a..0b729c6 100644 --- a/src/components/login/login.ts +++ b/src/components/login/login.ts @@ -19,9 +19,6 @@ export default class Login extends Vue */ public onLoginClick() { - // Call custom event - this.$emit('login:click', this.username, this.password); - // Make login button loading this.loading = true; From c19581e602ab853a1a32f2fcae45d7a261b98447 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Thu, 22 Aug 2019 16:24:32 +0800 Subject: [PATCH 2/2] [O] Optimize error handling in login.ts --- src/components/login/login.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/login/login.ts b/src/components/login/login.ts index 0b729c6..91ca99b 100644 --- a/src/components/login/login.ts +++ b/src/components/login/login.ts @@ -32,6 +32,12 @@ export default class Login extends Vue this.$emit('login:courses', JSON.parse(text)); }) }) - .catch(alert); + .catch(err => + { + alert(err); + + // Allow the user to retry + this.loading = false; + }); } }