[+] Fetch request

This commit is contained in:
Hykilpikonna
2019-08-19 20:22:00 +08:00
parent ec467dc5e8
commit e4bd1f7d50
+13 -1
View File
@@ -1,4 +1,5 @@
import {Component, Vue} from 'vue-property-decorator';
import Constants from '@/constants';
/**
* This component handles user login, and obtains data from the server.
@@ -12,10 +13,21 @@ export default class Login extends Vue
public password: any = '';
/**
* On click
* On click, sends username and password to the server.
*/
public onLoginClick()
{
// Call custom event
this.$emit('login:click', this.username, this.password);
// Fetch request TODO: Add username and password when the server is ready.
fetch(`${Constants.API_URL}/veracross/courses`).then(res =>
{
// Get response body text
res.text().then(text =>
{
})
})
.catch(alert);
}
}