+import { Subject } from 'rxjs'
+import { debounceTime, flatMap } from 'rxjs/operators'
import { Component, OnInit } from '@angular/core'
-import { Notifier } from '@app/core'
-import { AuthService } from '../../core/auth'
-import { ConfirmService } from '../../core/confirm'
-import { User } from '@app/shared'
-import { flatMap, debounceTime } from 'rxjs/operators'
+import { AuthService, ComponentPagination, ConfirmService, Notifier, User } from '@app/core'
+import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
import { I18n } from '@ngx-translate/i18n-polyfill'
-import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
-import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
-import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service'
import { VideoPlaylistType } from '@shared/models'
-import { Subject } from 'rxjs'
@Component({
selector: 'my-account-video-playlists',
.pipe(
debounceTime(500))
.subscribe(() => {
- this.loadVideoPlaylists()
+ this.loadVideoPlaylists(true)
})
}
this.videoPlaylistSearchChanged.next()
}
- private loadVideoPlaylists () {
+ private loadVideoPlaylists (reset = false) {
this.authService.userInformationLoaded
.pipe(flatMap(() => {
return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt', this.videoPlaylistsSearch)
}))
.subscribe(res => {
- this.videoPlaylists = []
+ if (reset) this.videoPlaylists = []
this.videoPlaylists = this.videoPlaylists.concat(res.data)
this.pagination.totalItems = res.total