[O] Use App.http instead of this.http
This commit is contained in:
@@ -114,7 +114,7 @@ export default class App extends Vue
|
||||
this.token = token;
|
||||
|
||||
// Assign token to http client
|
||||
this.http.token = token;
|
||||
App.http.token = token;
|
||||
|
||||
// Load data
|
||||
this.loadCoursesAfterLogin();
|
||||
@@ -125,7 +125,7 @@ export default class App extends Vue
|
||||
*/
|
||||
public loadCoursesAfterLogin()
|
||||
{
|
||||
this.http.post('/courses', {}).then(response =>
|
||||
App.http.post('/courses', {}).then(response =>
|
||||
{
|
||||
// Check success
|
||||
if (response.success)
|
||||
@@ -134,7 +134,7 @@ export default class App extends Vue
|
||||
this.courses = response.data.courses;
|
||||
|
||||
// Save CSRF token
|
||||
this.http.csrf = response.data.csrf;
|
||||
App.http.csrf = response.data.csrf;
|
||||
|
||||
// Load assignments
|
||||
this.loadAssignments();
|
||||
@@ -157,7 +157,7 @@ export default class App extends Vue
|
||||
this.courses.forEach(course =>
|
||||
{
|
||||
// Send request to get assignments
|
||||
this.http.post('/assignments', {'assignmentsId': course.assignmentsId}).then(response =>
|
||||
App.http.post('/assignments', {'assignmentsId': course.assignmentsId}).then(response =>
|
||||
{
|
||||
// Check success
|
||||
if (response.success)
|
||||
@@ -217,7 +217,7 @@ export default class App extends Vue
|
||||
else
|
||||
{
|
||||
// Request grading scheme for this course
|
||||
this.http.post('/grading', {'assignmentsId': course.assignmentsId}).then(response =>
|
||||
App.http.post('/grading', {'assignmentsId': course.assignmentsId}).then(response =>
|
||||
{
|
||||
// Check success
|
||||
if (response.success)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div id="app" class="theme-default">
|
||||
<login v-if="showLogin" v-on:login:token="onLogin" :http="http"></login>
|
||||
<login v-if="showLogin" v-on:login:token="onLogin"></login>
|
||||
<navigation :courses="filteredCourses"
|
||||
v-on:sign-out="signOut()"
|
||||
v-on:navigation:select="onNavigate">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {Component, Prop, Vue} from 'vue-property-decorator';
|
||||
import Constants from '@/constants';
|
||||
import {HttpUtils} from '@/utils/http-utils';
|
||||
import App from '@/components/app/app';
|
||||
|
||||
/**
|
||||
* This component handles user login, and obtains data from the server.
|
||||
@@ -17,9 +18,6 @@ export default class Login extends Vue
|
||||
public loading: boolean = false;
|
||||
public error: String = '';
|
||||
|
||||
@Prop()
|
||||
public http?: HttpUtils;
|
||||
|
||||
/**
|
||||
* This is called when the instance is created.
|
||||
*/
|
||||
@@ -42,7 +40,7 @@ export default class Login extends Vue
|
||||
this.loading = true;
|
||||
|
||||
// Fetch request
|
||||
(<HttpUtils> this.http).post('/login', {username: this.username, password: this.password})
|
||||
App.http.post('/login', {username: this.username, password: this.password})
|
||||
.then(response =>
|
||||
{
|
||||
// Check success
|
||||
|
||||
Reference in New Issue
Block a user