import { ConfirmService } from '../../../core'
import { Utils } from '../../../shared'
import { FriendService } from '../shared'
+import { Pod } from '../../../../../../shared'
@Component({
selector: 'my-friend-list',
export class FriendListComponent {
friendsSource = null
tableSettings = {
+ mode: 'external',
attr: {
class: 'table-hover'
},
position: 'right',
add: false,
edit: false,
- delete: false
+ delete: true
+ },
+ delete: {
+ deleteButtonContent: Utils.getRowDeleteButton()
},
columns: {
id: {
this.friendService.quitFriends().subscribe(
status => {
- this.notificationsService.success('Sucess', 'Friends left!')
-
+ this.notificationsService.success('Success', 'Friends left!')
this.friendsSource.refresh()
},
}
)
}
+
+ removeFriend ({ data }) {
+ const confirmMessage = 'Do you really want to remove this friend ? All its videos will be deleted.'
+ const friend: Pod = data
+
+ this.confirmService.confirm(confirmMessage, 'Remove').subscribe(
+ res => {
+ if (res === false) return
+
+ this.friendService.removeFriend(friend).subscribe(
+ status => {
+ this.notificationsService.success('Success', 'Friend removed')
+ this.friendsSource.refresh()
+ },
+
+ err => this.notificationsService.error('Error', err.text)
+ )
+ }
+ )
+ }
}