From 9e401fde36bdcb4b5e8dc54262c01f1e660d81a8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 6 Mar 2023 11:39:23 +0100 Subject: Refactor my actor avatar edit --- .../my-account-settings/my-account-settings.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'client/src/app/+my-account/my-account-settings') diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index 577f4a252..a276bb126 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts @@ -3,6 +3,7 @@ import { HttpErrorResponse } from '@angular/common/http' import { AfterViewChecked, Component, OnInit } from '@angular/core' import { AuthService, Notifier, User, UserService } from '@app/core' import { genericUploadErrorHandler } from '@app/helpers' +import { shallowCopy } from '@shared/core-utils' @Component({ selector: 'my-account-settings', @@ -44,6 +45,9 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { this.notifier.success($localize`Avatar changed.`) this.user.updateAccountAvatar(data.avatars) + + // So my-actor-avatar component detects changes + this.user.account = shallowCopy(this.user.account) }, error: (err: HttpErrorResponse) => genericUploadErrorHandler({ @@ -57,10 +61,13 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { onAvatarDelete () { this.userService.deleteAvatar() .subscribe({ - next: data => { + next: () => { this.notifier.success($localize`Avatar deleted.`) this.user.updateAccountAvatar() + + // So my-actor-avatar component detects changes + this.user.account = shallowCopy(this.user.account) }, error: (err: HttpErrorResponse) => this.notifier.error(err.message) -- cgit v1.2.3