[O] Make login.ts code a lot shorter

This commit is contained in:
Hykilpikonna
2019-12-02 13:58:17 -05:00
parent e99e6170b8
commit af38e4b7d7
+9 -12
View File
@@ -11,16 +11,16 @@ import VersionUtils from '@/logic/utils/version-utils';
}) })
export default class Login extends Vue export default class Login extends Vue
{ {
public username: string = ''; username = '';
public password: string = ''; password = '';
public loading: boolean = false; loading = false;
public error: string = ''; error = '';
/** /**
* This is called when the instance is created. * This is called when the instance is created.
*/ */
public created() created()
{ {
// Check login cookies // Check login cookies
if (this.$cookies.isKey('va.token')) 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')); this.$emit('login:token', this.$cookies.get('va.token'));
} }
} }
else else console.log('Cookies doesn\'t exist');
{
console.log('Cookies doesn\'t exist');
}
} }
/** /**
@@ -51,7 +48,7 @@ export default class Login extends Vue
* *
* @returns boolean Need to clear cookies or not * @returns boolean Need to clear cookies or not
*/ */
public needToUpdateCookies(): boolean needToUpdateCookies(): boolean
{ {
// Version doesn't exist // Version doesn't exist
if (!this.$cookies.isKey('va.version')) return true; 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. * When the user clicks, send the username and password to the server.
*/ */
public onLoginClick() onLoginClick()
{ {
// Make login button loading // Make login button loading
this.loading = true; 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. * This is called when the user hits enter on the input boxes.
*/ */
public onEnter() onEnter()
{ {
this.onLoginClick(); this.onLoginClick();
} }