message: Fix access to error message
  Refactor code to async/await
diff: @@ -119,7 +119,7 @@ export class GeneralTabComponent implements OnInit {
  });
  }
  - createCourse() {
  + async createCourse() {
  this.showProgress.toggleLoadingGlobal(true);
  const request: any = {
  @@ -132,20 +132,20 @@ export class GeneralTabComponent implements OnInit {
  request.accessKey = this.accessKey;
  }
  - this.courseService.updateItem(request).then(
  - (val) => {
  - this.notificationService.createItem(
  - {changedCourse: val, changedLecture: null,
  - changedUnit: null, text: 'Course ' + val.name + ' has been updated.'})
  - .catch(console.error);
  + try {
  + const course = await this.courseService.updateItem(request);
  +
  + this.notificationService.createItem({
  + changedCourse: course, changedLecture: null,
  + changedUnit: null, text: 'Course ' + course.name + ' has been updated.'
  + });
  +
  this.showProgress.toggleLoadingGlobal(false);
  this.snackBar.open('Saved successfully', '', {duration: 5000});
  - }, (error) => {
  + } catch (err) {
  this.showProgress.toggleLoadingGlobal(false);
  - // Mongodb uses the error field errmsg
  - const errormessage = error.json().message || error.json().errmsg;
  - this.snackBar.open('Saving course failed ' + errormessage, 'Dismiss');
  - });
  + this.snackBar.open('Saving course failed ' + err.error.message, 'Dismiss');
  + }
  }
  async onExport() {
  @@ -182,8 +182,10 @@ export class GeneralTabComponent implements OnInit {
  return;
  }
  this.notificationService.createItem(
  - {changedCourse: this.courseOb, changedLecture: null,
  - changedUnit: null, text: 'Course ' + this.courseOb.name + ' has been deleted.'})
  + {
  + changedCourse: this.courseOb, changedLecture: null,
  + changedUnit: null, text: 'Course ' + this.courseOb.name + ' has been deleted.'
  + })
  .catch(console.error);
  await this.courseService.deleteItem(this.courseOb);
  await this.router.navigate(['/']);
  