4 courseArray: courseArray
,
14 redirect: function(code
) {
15 document
.location
.href
= "/" + initials
+ "/" + code
;
17 addCourse: function() {
20 // modal, fill code and description
21 let error
= Validator
.checkObject({code:this.newCourse
.code
}, "Course");
25 $('#newCourse').modal('close');
34 this.newCourse
["code"] = "";
35 this.newCourse
["description"] = "";
36 this.courseArray
.push(res
);
44 deleteCourse: function(course
) {
47 if (confirm("Delete course '" + course
.code
+ "' ?"))
48 $.ajax("/remove/course",
51 data: { cid: course
._id
},
55 this.courseArray
.splice( this.courseArray
.findIndex( item
=> {
56 return item
._id
== course
._id
;