message: App: Change user-image.directive getImage to async
diff: @@ -27,25 +27,25 @@ export class UserImageDirective implements OnInit {
  constructor(private backendService: BackendService, private domSanitizer: DomSanitizer) {
  }
  - ngOnChanges(changes: { [propKey: string]: SimpleChange }) {
  + async ngOnChanges(changes: { [propKey: string]: SimpleChange }) {
  for (const propName in changes) {
  if (changes.hasOwnProperty(propName)) {
  const changedProp = changes[propName];
  this[propName] = changedProp.currentValue;
  }
  }
  - this.getImage();
  + await this.getImage();
  }
  - ngOnInit(): void {
  - this.getImage();
  + async ngOnInit() {
  + await this.getImage();
  }
  ngOnDestroy() {
  URL.revokeObjectURL(this.objectUrl);
  }
  - getImage() {
  + async getImage() {
  // FIXME maybe refactor this 'if' to an early exit?
  if (this.user) {
  // FIXME is the following line actually required?
  @@ -53,13 +53,11 @@ export class UserImageDirective implements OnInit {
  this.width = this.size;
  this.height = this.size;
  this.borderRadius = '50%';
  - // FIXME change this to async await?
  - this.backendService.getDownload(user.getUserImageURL()).toPromise().then(response => {
  - // FIXME error handling?
  + const response = await this.backendService.getDownload(user.getUserImageURL()).toPromise();
  + // FIXME response error handling?
  URL.revokeObjectURL(this.objectUrl);
  this.objectUrl = URL.createObjectURL(response.body);
  this.backgroundImage = this.domSanitizer.bypassSecurityTrustStyle(`url(${this.objectUrl})`);
  - });
  }
  }
  