Load user when auth service is ready

This commit is contained in:
Chocobozzz 2021-01-15 09:51:26 +01:00
parent 53d43fc914
commit d29ae17f30
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 12 additions and 9 deletions

View File

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