[-] Remove courses request in app.ts
This commit is contained in:
@@ -94,37 +94,13 @@ export default class App extends Vue
|
|||||||
|
|
||||||
// Store user
|
// Store user
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
this.courses = user.courses
|
||||||
|
|
||||||
// Assign user to http client
|
// Assign user to http client
|
||||||
App.http.user = user;
|
App.http.user = user;
|
||||||
|
|
||||||
// Load data
|
// Load assignments
|
||||||
this.loadCoursesAfterLogin();
|
this.loadAssignments();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load courses data after logging in.
|
|
||||||
*/
|
|
||||||
loadCoursesAfterLogin()
|
|
||||||
{
|
|
||||||
// Show loading message
|
|
||||||
this.logLoading('2. Loading courses...');
|
|
||||||
|
|
||||||
// Post request
|
|
||||||
App.http.post('/courses', {}).then(response =>
|
|
||||||
{
|
|
||||||
// Check success
|
|
||||||
if (response.success)
|
|
||||||
{
|
|
||||||
// Save courses
|
|
||||||
this.courses = response.data.map((courseJson: any) => new Course(courseJson));
|
|
||||||
|
|
||||||
// Load assignments
|
|
||||||
this.loadAssignments();
|
|
||||||
}
|
|
||||||
else throw new Error(response.data);
|
|
||||||
})
|
|
||||||
.catch(e => this.showError(`Error: Course data failed to load.\n(${e})`));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,7 +109,7 @@ export default class App extends Vue
|
|||||||
loadAssignments()
|
loadAssignments()
|
||||||
{
|
{
|
||||||
// Show loading message
|
// Show loading message
|
||||||
this.logLoading('3. Loading assignments...');
|
this.logLoading('1. Loading assignments...');
|
||||||
|
|
||||||
// Get assignments for all the courses
|
// Get assignments for all the courses
|
||||||
this.courses.forEach(course =>
|
this.courses.forEach(course =>
|
||||||
@@ -168,7 +144,7 @@ export default class App extends Vue
|
|||||||
checkGradingAlgorithms()
|
checkGradingAlgorithms()
|
||||||
{
|
{
|
||||||
// Show loading message
|
// Show loading message
|
||||||
this.logLoading('4. Checking grading algorithms...');
|
this.logLoading('2. Checking grading algorithms...');
|
||||||
|
|
||||||
// Loop through all the courses
|
// Loop through all the courses
|
||||||
for (const course of this.gradedCourses)
|
for (const course of this.gradedCourses)
|
||||||
|
|||||||
Reference in New Issue
Block a user