[+] Create http field in App.ts
This commit is contained in:
@@ -5,6 +5,7 @@ import Overall from '@/pages/overall/overall';
|
|||||||
import Constants from '@/constants';
|
import Constants from '@/constants';
|
||||||
import JsonUtils from '@/utils/json-utils';
|
import JsonUtils from '@/utils/json-utils';
|
||||||
import pWaitFor from 'p-wait-for';
|
import pWaitFor from 'p-wait-for';
|
||||||
|
import {HttpUtils} from '@/utils/http-utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Objects of this interface represent assignment grades.
|
* Objects of this interface represent assignment grades.
|
||||||
@@ -55,6 +56,9 @@ export default class App extends Vue
|
|||||||
// Token
|
// Token
|
||||||
public token: string = '';
|
public token: string = '';
|
||||||
|
|
||||||
|
// Http Client
|
||||||
|
public http: HttpUtils = new HttpUtils('');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called when the instance is created.
|
* This is called when the instance is created.
|
||||||
*/
|
*/
|
||||||
@@ -77,6 +81,9 @@ export default class App extends Vue
|
|||||||
// Store token
|
// Store token
|
||||||
this.token = token;
|
this.token = token;
|
||||||
|
|
||||||
|
// Assign token to http client
|
||||||
|
this.http.token = token;
|
||||||
|
|
||||||
// Load data
|
// Load data
|
||||||
this.loadCoursesAfterLogin();
|
this.loadCoursesAfterLogin();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Constants from '@/constants';
|
|||||||
|
|
||||||
export class HttpUtils
|
export class HttpUtils
|
||||||
{
|
{
|
||||||
private token: string = '';
|
public token: string = '';
|
||||||
|
|
||||||
constructor (token: string)
|
constructor (token: string)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user