aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-moderation/bulk.service.ts
blob: 36d1b0b1ed65426bd812565c5382b06300f7f314 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { catchError } from 'rxjs/operators'
import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { RestExtractor } from '@app/core'
import { BulkRemoveCommentsOfBody } from '@peertube/peertube-models'
import { environment } from '../../../environments/environment'

@Injectable()
export class BulkService {
  static BASE_BULK_URL = environment.apiUrl + '/api/v1/bulk'

  constructor (
    private authHttp: HttpClient,
    private restExtractor: RestExtractor
  ) { }

  removeCommentsOf (body: BulkRemoveCommentsOfBody) {
    const url = BulkService.BASE_BULK_URL + '/remove-comments-of'

    return this.authHttp.post(url, body)
                        .pipe(catchError(err => this.restExtractor.handleError(err)))
  }
}