diff --git a/src/components/login/login.ts b/src/components/login/login.ts
index 1d9fae9..596a0b9 100644
--- a/src/components/login/login.ts
+++ b/src/components/login/login.ts
@@ -59,19 +59,10 @@ export default class Login extends Vue
}
/**
- * When the user clicks, send the username and password to the server.
+ * When the user clicks, post the login request and process the response
* This is also called when the user hits enter on the input boxes.
*/
- onLoginClick()
- {
- this.login()
- }
-
-
- /**
- * Actually post the login request and process the response
- */
- login()
+ loginClick()
{
// Make login button loading
this.loading = true;
@@ -79,8 +70,18 @@ export default class Login extends Vue
// Format it
this.username = this.username.toLowerCase().replace(/ /g, '').replace(/@.*/g, '');
+ // Actually login
+ this.login('/login', {username: this.username, password: this.password})
+ }
+
+
+ /**
+ * Actually post the request and process the response
+ */
+ login(url: string, data: any)
+ {
// Fetch request
- App.http.post('/login', {username: this.username, password: this.password}).then(response =>
+ App.http.post(url, data).then(response =>
{
// Check success
if (response.success)
@@ -114,14 +115,6 @@ export default class Login extends Vue
});
}
- /**
- * This is called when the user hits enter on the input boxes.
- */
- onEnter()
- {
- this.onLoginClick();
- }
-
/**
* Clear cookies
*/
diff --git a/src/components/login/login.vue b/src/components/login/login.vue
index bed8812..fa3de53 100644
--- a/src/components/login/login.vue
+++ b/src/components/login/login.vue
@@ -10,7 +10,7 @@
placeholder="SJP Username (Eg. flast21)"
:class="{'input-error': error !== ''}"
v-if="!disableInput"
- @keyup.enter.native="onEnter">
+ @keyup.enter.native="loginClick">