From e99e6170b81489d314d0fbb4cdad6b2d3c1af62a Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Mon, 2 Dec 2019 13:55:58 -0500 Subject: [PATCH] [O] Encapsulate login() --- src/components/login/login.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/login/login.ts b/src/components/login/login.ts index 6a5e7a8..666a6a4 100644 --- a/src/components/login/login.ts +++ b/src/components/login/login.ts @@ -71,8 +71,20 @@ export default class Login extends Vue // Format it this.username = this.username.toLowerCase().replace(/ /g, '').replace(/@.*/g, ''); + // Login + this.login('/login', {username: this.username, password: this.password}); + } + + /** + * Actually post the login request and process the response + * + * @param url Posting url + * @param data Data to be posted + */ + login(url: string, data: any) + { // Fetch request - App.http.post('/login', {username: this.username, password: this.password}) + App.http.post(url, data) .then(response => { // Check success