diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-03-14 09:26:04 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-03-14 09:26:04 +0200 |
| commit | 7752a79fe5d8dd498ba0b7a842bbae19d38bd963 (patch) | |
| tree | 40fe56f84b93fef7189a82fd18561bdbd2e94a19 /src/app | |
| parent | d2d4452bfa4861458bc0ba6a618c2a27decc8051 (diff) | |
| download | DevHive-Angular-7752a79fe5d8dd498ba0b7a842bbae19d38bd963.tar DevHive-Angular-7752a79fe5d8dd498ba0b7a842bbae19d38bd963.tar.gz DevHive-Angular-7752a79fe5d8dd498ba0b7a842bbae19d38bd963.zip | |
Fixed settings page having an outdated link and routing user to outdated profile page when changing username
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/components/profile-settings/profile-settings.component.ts | 6 |
1 files changed, 6 insertions, 0 deletions
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); |
