diff options
| -rw-r--r-- | src/app/components/profile/profile.component.ts | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/app/components/profile/profile.component.ts b/src/app/components/profile/profile.component.ts index 429b9b8..73e1e96 100644 --- a/src/app/components/profile/profile.component.ts +++ b/src/app/components/profile/profile.component.ts @@ -169,20 +169,24 @@ export class ProfileComponent implements OnInit { loggedInUser.friends.push(newFriend); } - this._userService.putBareUserFromSessionStorageRequest(loggedInUser, this.updateFrienship.get('password')?.value).subscribe({ - next: () => { - this.reloadPage(); - }, - error: () => { - this._router.navigate(['/']); - } - }); + this.updateUserWithNewFriends(loggedInUser); } }); } this.updatingFriendship = !this.updatingFriendship; } + private updateUserWithNewFriends(loggedInUser: User): void { + this._userService.putBareUserFromSessionStorageRequest(loggedInUser, this.updateFrienship.get('password')?.value).subscribe({ + next: () => { + this.reloadPage(); + }, + error: () => { + this._router.navigate(['/']); + } + }); + } + onScroll(event: any): void { // Detects when the element has reached the bottom, thx https://stackoverflow.com/a/50038429/12036073 if (event.target.offsetHeight + event.target.scrollTop >= event.target.scrollHeight && this._currentPage > 0) { |
