From 7752a79fe5d8dd498ba0b7a842bbae19d38bd963 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 14 Mar 2021 09:26:04 +0200 Subject: Fixed settings page having an outdated link and routing user to outdated profile page when changing username --- src/app/components/profile-settings/profile-settings.component.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/app/components/profile-settings/profile-settings.component.ts b/src/app/components/profile-settings/profile-settings.component.ts index b856bef..b314a9a 100644 --- a/src/app/components/profile-settings/profile-settings.component.ts +++ b/src/app/components/profile-settings/profile-settings.component.ts @@ -200,6 +200,12 @@ export class ProfileSettingsComponent implements OnInit { this._userService.putUserFromSessionStorageRequest(this.updateUserFormGroup, this.user.roles, this.user.friends).subscribe({ next: () => { this._successBar.showMsg('Profile updated successfully!'); + + // "Reload" page when changing username + const newUsername = this.updateUserFormGroup.get('username')?.value; + if (newUsername !== this._urlUsername) { + this._router.navigate(['/profile/' + newUsername + '/settings']); + } }, error: (err: HttpErrorResponse) => { this._errorBar.showError(err); -- cgit v1.2.3