bstlboard-front/src/app/pages/moderation/comments/moderation.comments.page.ts

42 lines
1.1 KiB
TypeScript

import { Component, OnInit, Input } from '@angular/core';
import { ModerationService } from '../../../services/moderarion.service';
@Component({
selector: 'page-moderation-comments',
templateUrl: './moderation.comments.page.html'
})
export class PageModerationComments implements OnInit {
comments: any = {};
boundRefresh: Function;
constructor(private moderationService: ModerationService,) { }
ngOnInit(): void {
this.boundRefresh = this.refresh.bind(this);
this.refresh();
}
refresh(): void {
this.moderationService.getFlaggedComments(this.comments.number || 0, this.comments.size || 30).subscribe({
next: (data: any) => {
this.comments = data;
}
})
}
showMore() {
const oldContent: any[] = this.comments.content;
this.moderationService.getFlaggedComments(this.comments.number + 1, this.comments.size).subscribe({
next: (data) => {
this.comments = data;
for (let comment of this.comments.content) {
oldContent.push(comment);
}
this.comments.content = oldContent;
}
})
}
}