import { SortMeta } from 'primeng/api'
import { Component, OnInit, ViewChild } from '@angular/core'
import { Notifier, RestPagination, RestTable } from '@app/core'
-import { Account, Actor, VideoOwnershipService } from '@app/shared/shared-main'
+import { Account, VideoOwnershipService } from '@app/shared/shared-main'
import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '@shared/models'
import { MyAcceptOwnershipComponent } from './my-accept-ownership/my-accept-ownership.component'
}
}
- switchToDefaultAvatar ($event: Event) {
- ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL()
- }
-
openAcceptModal (videoChangeOwnership: VideoChangeOwnership) {
this.myAccountAcceptOwnershipComponent.show(videoChangeOwnership)
}
accepted () {
- this.loadData()
+ this.reloadData()
}
refuse (videoChangeOwnership: VideoChangeOwnership) {
this.videoOwnershipService.refuseOwnership(videoChangeOwnership.id)
- .subscribe(
- () => this.loadData(),
- err => this.notifier.error(err.message)
- )
+ .subscribe({
+ next: () => this.reloadData(),
+ error: err => this.notifier.error(err.message)
+ })
}
- protected loadData () {
+ protected reloadDataInternal () {
return this.videoOwnershipService.getOwnershipChanges(this.pagination, this.sort)
- .subscribe(
- resultList => {
+ .subscribe({
+ next: resultList => {
this.videoChangeOwnerships = resultList.data.map(change => ({
...change,
initiatorAccount: new Account(change.initiatorAccount),
this.totalRecords = resultList.total
},
- err => this.notifier.error(err.message)
- )
+ error: err => this.notifier.error(err.message)
+ })
}
}