[+] Enable and disable loading at appropriate time

This commit is contained in:
Hykilpikonna
2019-08-21 14:56:50 +08:00
parent 6b15b617cf
commit e7daac738d
+6
View File
@@ -22,12 +22,18 @@ export default class Login extends Vue
// Call custom event
this.$emit('login:click', this.username, this.password);
// Make login button loading
this.loading = true;
// Fetch request TODO: Add username and password when the https server is ready.
fetch(`${Constants.API_URL}/veracross/courses`).then(res =>
{
// Get response body text
res.text().then(text =>
{
// Disable loading
this.loading = false;
// Call custom event with courses info
this.$emit('login:courses', JSON.parse(text));
})