aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/app/shared/shared-moderation/bulk.service.ts
blob: f0b8694215b4705022f8df54d1ce7e01029ac880 (plain) (tree)
1
2
3
4
5
6
                                           

                                                 

                                                         
                                                               






                                                            
                                        








                                                                                     
import { catchError } from 'rxjs/operators'
import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { RestExtractor } from '@app/core'
import { BulkRemoveCommentsOfBody } from '@shared/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)))
  }
}