1 import { Component, OnInit } from '@angular/core'
2 import { Notifier } from '@app/core'
3 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
4 import { UserSubscriptionService } from '@app/shared/user-subscription'
5 import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
8 selector: 'my-account-subscriptions',
9 templateUrl: './my-account-subscriptions.component.html',
10 styleUrls: [ './my-account-subscriptions.component.scss' ]
12 export class MyAccountSubscriptionsComponent implements OnInit {
13 videoChannels: VideoChannel[] = []
15 pagination: ComponentPagination = {
22 private userSubscriptionService: UserSubscriptionService,
23 private notifier: Notifier
27 this.loadSubscriptions()
30 loadSubscriptions () {
31 this.userSubscriptionService.listSubscriptions(this.pagination)
34 this.videoChannels = this.videoChannels.concat(res.data)
35 this.pagination.totalItems = res.total
38 error => this.notifier.error(error.message)
44 if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return
46 this.pagination.currentPage += 1
47 this.loadSubscriptions()