From af38e4b7d725ba50a6daf96c007937ed0c97b5b6 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Mon, 2 Dec 2019 13:58:17 -0500 Subject: [PATCH] [O] Make login.ts code a lot shorter --- src/components/login/login.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/components/login/login.ts b/src/components/login/login.ts index 666a6a4..bcf072c 100644 --- a/src/components/login/login.ts +++ b/src/components/login/login.ts @@ -11,16 +11,16 @@ import VersionUtils from '@/logic/utils/version-utils'; }) export default class Login extends Vue { - public username: string = ''; - public password: string = ''; + username = ''; + password = ''; - public loading: boolean = false; - public error: string = ''; + loading = false; + error = ''; /** * This is called when the instance is created. */ - public created() + created() { // Check login cookies if (this.$cookies.isKey('va.token')) @@ -40,10 +40,7 @@ export default class Login extends Vue this.$emit('login:token', this.$cookies.get('va.token')); } } - else - { - console.log('Cookies doesn\'t exist'); - } + else console.log('Cookies doesn\'t exist'); } /** @@ -51,7 +48,7 @@ export default class Login extends Vue * * @returns boolean Need to clear cookies or not */ - public needToUpdateCookies(): boolean + needToUpdateCookies(): boolean { // Version doesn't exist if (!this.$cookies.isKey('va.version')) return true; @@ -63,7 +60,7 @@ export default class Login extends Vue /** * When the user clicks, send the username and password to the server. */ - public onLoginClick() + onLoginClick() { // Make login button loading this.loading = true; @@ -119,7 +116,7 @@ export default class Login extends Vue /** * This is called when the user hits enter on the input boxes. */ - public onEnter() + onEnter() { this.onLoginClick(); }