Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Load user when auth service is ready

Chocobozzzd29ae17f3058
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 bd0337c1d2..6d19707df7 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 @@
+import { switchMap } from 'rxjs/operators'
import { Component, OnDestroy, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { AuthService, LocalStorageService, Notifier, ScopedTokensService, ScreenService, ServerService, UserService } from '@app/core'
@@ -53,16 +54,18 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement
const user = this.authService.getUser()
let feedUrl = environment.originServerUrl
- this.scopedTokensService.getScopedTokens().subscribe(
- tokens => {
- const feeds = this.videoService.getVideoSubscriptionFeedUrls(user.account.id, tokens.feedToken)
- feedUrl = feedUrl + feeds.find(f => f.format === FeedFormat.RSS).url
- },
+ this.authService.userInformationLoaded
+ .pipe(switchMap(() => this.scopedTokensService.getScopedTokens()))
+ .subscribe(
+ tokens => {
+ const feeds = this.videoService.getVideoSubscriptionFeedUrls(user.account.id, tokens.feedToken)
+ feedUrl = feedUrl + feeds.find(f => f.format === FeedFormat.RSS).url
+ },
- err => {
- this.notifier.error(err.message)
- }
- )
+ err => {
+ this.notifier.error(err.message)
+ }
+ )
this.actions.unshift({
label: $localize`Feed`,