diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-03-14 08:37:10 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-03-14 08:37:10 +0200 |
| commit | c073a058bb7e97e6a9319e88f3f7765d4a466bd0 (patch) | |
| tree | 7854b7bb8e07af64d052ce7eeb499c1af5d07d91 /src | |
| parent | 807e72b990e7412bdf243095a07bd716bb93453f (diff) | |
| download | DevHive-Angular-c073a058bb7e97e6a9319e88f3f7765d4a466bd0.tar DevHive-Angular-c073a058bb7e97e6a9319e88f3f7765d4a466bd0.tar.gz DevHive-Angular-c073a058bb7e97e6a9319e88f3f7765d4a466bd0.zip | |
Updated feed's subscriptions to use an observer object
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/components/feed/feed.component.ts | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/app/components/feed/feed.component.ts b/src/app/components/feed/feed.component.ts index eaa0ef1..a9a042c 100644 --- a/src/app/components/feed/feed.component.ts +++ b/src/app/components/feed/feed.component.ts @@ -49,27 +49,27 @@ export class FeedComponent implements OnInit { fileUpload: new FormControl('') }); - this._userService.getUserFromSessionStorageRequest().subscribe( - (res: object) => { + this._userService.getUserFromSessionStorageRequest().subscribe({ + next: (res: object) => { Object.assign(this.user, res); this.loadFeed(); }, - () => { + error: () => { this.logout(); } - ); + }); } private loadFeed(): void { - this._feedService.getUserFeedFromSessionStorageRequest(this._currentPage++, this._timeLoaded, AppConstants.PAGE_SIZE).subscribe( - (result: object) => { + this._feedService.getUserFeedFromSessionStorageRequest(this._currentPage++, this._timeLoaded, AppConstants.PAGE_SIZE).subscribe({ + next: (result: object) => { this.posts.push(...Object.values(result)[0]); this.finishUserLoading(); }, - () => { + error: () => { this.finishUserLoading(); } - ); + }); } private finishUserLoading(): void { @@ -102,14 +102,14 @@ export class FeedComponent implements OnInit { const postMessage = this.createPostFormGroup.get('newPostMessage')?.value; this.dataArrived = false; - this._postService.createPostWithSessionStorageRequest(postMessage, this.files).subscribe( - () => { + this._postService.createPostWithSessionStorageRequest(postMessage, this.files).subscribe({ + next: () => { this.goToProfile(); }, - () => { + error: () => { this.dataArrived = true; } - ); + }); } onScroll(event: any): void { |
