[+] Fetch request
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import {Component, Vue} from 'vue-property-decorator';
|
import {Component, Vue} from 'vue-property-decorator';
|
||||||
|
import Constants from '@/constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component handles user login, and obtains data from the server.
|
* This component handles user login, and obtains data from the server.
|
||||||
@@ -12,10 +13,21 @@ export default class Login extends Vue
|
|||||||
public password: any = '';
|
public password: any = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On click
|
* On click, sends username and password to the server.
|
||||||
*/
|
*/
|
||||||
public onLoginClick()
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user