diff options
author | Chocobozzz <me@florianbigard.com> | 2021-01-15 09:51:26 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-01-15 10:23:40 +0100 |
commit | d29ae17f3058006e4c88399800d30ee73a60ba5f (patch) | |
tree | 14815696ae0201c49e1c94285ef88fb77817af14 /client | |
parent | 53d43fc9147059f3d265140e025a6ebd802481dc (diff) | |
download | PeerTube-d29ae17f3058006e4c88399800d30ee73a60ba5f.tar.gz PeerTube-d29ae17f3058006e4c88399800d30ee73a60ba5f.tar.zst PeerTube-d29ae17f3058006e4c88399800d30ee73a60ba5f.zip |
Load user when auth service is ready
Diffstat (limited to 'client')
-rw-r--r-- | client/src/app/+videos/video-list/video-user-subscriptions.component.ts | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts index bd0337c1d..6d19707df 100644 --- a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | 1 | ||
2 | import { switchMap } from 'rxjs/operators' | ||
2 | import { Component, OnDestroy, OnInit } from '@angular/core' | 3 | import { Component, OnDestroy, OnInit } from '@angular/core' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 4 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { AuthService, LocalStorageService, Notifier, ScopedTokensService, ScreenService, ServerService, UserService } from '@app/core' | 5 | import { AuthService, LocalStorageService, Notifier, ScopedTokensService, ScreenService, ServerService, UserService } from '@app/core' |
@@ -53,16 +54,18 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
53 | const user = this.authService.getUser() | 54 | const user = this.authService.getUser() |
54 | let feedUrl = environment.originServerUrl | 55 | let feedUrl = environment.originServerUrl |
55 | 56 | ||
56 | this.scopedTokensService.getScopedTokens().subscribe( | 57 | this.authService.userInformationLoaded |
57 | tokens => { | 58 | .pipe(switchMap(() => this.scopedTokensService.getScopedTokens())) |
58 | const feeds = this.videoService.getVideoSubscriptionFeedUrls(user.account.id, tokens.feedToken) | 59 | .subscribe( |
59 | feedUrl = feedUrl + feeds.find(f => f.format === FeedFormat.RSS).url | 60 | tokens => { |
60 | }, | 61 | const feeds = this.videoService.getVideoSubscriptionFeedUrls(user.account.id, tokens.feedToken) |
62 | feedUrl = feedUrl + feeds.find(f => f.format === FeedFormat.RSS).url | ||
63 | }, | ||
61 | 64 | ||
62 | err => { | 65 | err => { |
63 | this.notifier.error(err.message) | 66 | this.notifier.error(err.message) |
64 | } | 67 | } |
65 | ) | 68 | ) |
66 | 69 | ||
67 | this.actions.unshift({ | 70 | this.actions.unshift({ |
68 | label: $localize`Feed`, | 71 | label: $localize`Feed`, |