]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Load user when auth service is ready
authorChocobozzz <me@florianbigard.com>
Fri, 15 Jan 2021 08:51:26 +0000 (09:51 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 15 Jan 2021 09:23:40 +0000 (10:23 +0100)
client/src/app/+videos/video-list/video-user-subscriptions.component.ts

index bd0337c1d2018530e51c92ad0bd862d85ccec602..6d19707df7baa36e3cefffa29be15e0003ebd6f8 100644 (file)
@@ -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`,