From d29ae17f3058006e4c88399800d30ee73a60ba5f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 15 Jan 2021 09:51:26 +0100 Subject: Load user when auth service is ready --- .../video-user-subscriptions.component.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'client/src') 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 @@ +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`, -- cgit v1.2.3