mirror of https://github.com/Chocobozzz/PeerTube
Reload overviews page on logout
parent
675f219639
commit
bd1dd8fd95
|
@ -1,5 +1,5 @@
|
||||||
import { Subject } from 'rxjs'
|
import { Subject, Subscription, switchMap } from 'rxjs'
|
||||||
import { Component, OnInit } from '@angular/core'
|
import { Component, OnDestroy, OnInit } from '@angular/core'
|
||||||
import { Notifier, ScreenService, User, UserService } from '@app/core'
|
import { Notifier, ScreenService, User, UserService } from '@app/core'
|
||||||
import { Video } from '@app/shared/shared-main'
|
import { Video } from '@app/shared/shared-main'
|
||||||
import { OverviewService } from './overview.service'
|
import { OverviewService } from './overview.service'
|
||||||
|
@ -10,7 +10,7 @@ import { VideosOverview } from './videos-overview.model'
|
||||||
templateUrl: './video-overview.component.html',
|
templateUrl: './video-overview.component.html',
|
||||||
styleUrls: [ './video-overview.component.scss' ]
|
styleUrls: [ './video-overview.component.scss' ]
|
||||||
})
|
})
|
||||||
export class VideoOverviewComponent implements OnInit {
|
export class VideoOverviewComponent implements OnInit, OnDestroy {
|
||||||
onDataSubject = new Subject<any>()
|
onDataSubject = new Subject<any>()
|
||||||
|
|
||||||
overviews: VideosOverview[] = []
|
overviews: VideosOverview[] = []
|
||||||
|
@ -24,6 +24,8 @@ export class VideoOverviewComponent implements OnInit {
|
||||||
private lastWasEmpty = false
|
private lastWasEmpty = false
|
||||||
private isLoading = false
|
private isLoading = false
|
||||||
|
|
||||||
|
private userSub: Subscription
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private notifier: Notifier,
|
private notifier: Notifier,
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
|
@ -37,8 +39,18 @@ export class VideoOverviewComponent implements OnInit {
|
||||||
this.userService.getAnonymousOrLoggedUser()
|
this.userService.getAnonymousOrLoggedUser()
|
||||||
.subscribe(user => this.userMiniature = user)
|
.subscribe(user => this.userMiniature = user)
|
||||||
|
|
||||||
this.userService.listenAnonymousUpdate()
|
this.userSub = this.userService.listenAnonymousUpdate()
|
||||||
.subscribe(user => this.userMiniature = user)
|
.pipe(switchMap(() => this.userService.getAnonymousOrLoggedUser()))
|
||||||
|
.subscribe(user => {
|
||||||
|
this.userMiniature = user
|
||||||
|
|
||||||
|
this.overviews = []
|
||||||
|
this.loadMoreResults()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy () {
|
||||||
|
if (this.userSub) this.userSub.unsubscribe()
|
||||||
}
|
}
|
||||||
|
|
||||||
buildVideoChannelBy (object: { videos: Video[] }) {
|
buildVideoChannelBy (object: { videos: Video[] }) {
|
||||||
|
|
Loading…
Reference in New Issue