diff options
Diffstat (limited to 'client/src/app/shared/shared-moderation')
-rw-r--r-- | client/src/app/shared/shared-moderation/abuse.service.ts | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/client/src/app/shared/shared-moderation/abuse.service.ts b/client/src/app/shared/shared-moderation/abuse.service.ts index f45b5c8e8..5d1539f69 100644 --- a/client/src/app/shared/shared-moderation/abuse.service.ts +++ b/client/src/app/shared/shared-moderation/abuse.service.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { omit } from 'lodash-es' | 1 | import { omit } from 'lodash-es' |
2 | import { SortMeta } from 'primeng/api' | 2 | import { SortMeta } from 'primeng/api' |
3 | import { Observable } from 'rxjs' | 3 | import { Observable } from 'rxjs' |
4 | import { catchError, map } from 'rxjs/operators' | 4 | import { catchError } from 'rxjs/operators' |
5 | import { HttpClient, HttpParams } from '@angular/common/http' | 5 | import { HttpClient, HttpParams } from '@angular/common/http' |
6 | import { Injectable } from '@angular/core' | 6 | import { Injectable } from '@angular/core' |
7 | import { RestExtractor, RestPagination, RestService } from '@app/core' | 7 | import { RestExtractor, RestPagination, RestService } from '@app/core' |
@@ -77,40 +77,28 @@ export class AbuseService { | |||
77 | const body = omit(parameters, [ 'id' ]) | 77 | const body = omit(parameters, [ 'id' ]) |
78 | 78 | ||
79 | return this.authHttp.post(url, body) | 79 | return this.authHttp.post(url, body) |
80 | .pipe( | 80 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
81 | map(this.restExtractor.extractDataBool), | ||
82 | catchError(res => this.restExtractor.handleError(res)) | ||
83 | ) | ||
84 | } | 81 | } |
85 | 82 | ||
86 | updateAbuse (abuse: AdminAbuse, abuseUpdate: AbuseUpdate) { | 83 | updateAbuse (abuse: AdminAbuse, abuseUpdate: AbuseUpdate) { |
87 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id | 84 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id |
88 | 85 | ||
89 | return this.authHttp.put(url, abuseUpdate) | 86 | return this.authHttp.put(url, abuseUpdate) |
90 | .pipe( | 87 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
91 | map(this.restExtractor.extractDataBool), | ||
92 | catchError(res => this.restExtractor.handleError(res)) | ||
93 | ) | ||
94 | } | 88 | } |
95 | 89 | ||
96 | removeAbuse (abuse: AdminAbuse) { | 90 | removeAbuse (abuse: AdminAbuse) { |
97 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id | 91 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id |
98 | 92 | ||
99 | return this.authHttp.delete(url) | 93 | return this.authHttp.delete(url) |
100 | .pipe( | 94 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
101 | map(this.restExtractor.extractDataBool), | ||
102 | catchError(res => this.restExtractor.handleError(res)) | ||
103 | ) | ||
104 | } | 95 | } |
105 | 96 | ||
106 | addAbuseMessage (abuse: UserAbuse, message: string) { | 97 | addAbuseMessage (abuse: UserAbuse, message: string) { |
107 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages' | 98 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages' |
108 | 99 | ||
109 | return this.authHttp.post(url, { message }) | 100 | return this.authHttp.post(url, { message }) |
110 | .pipe( | 101 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
111 | map(this.restExtractor.extractDataBool), | ||
112 | catchError(res => this.restExtractor.handleError(res)) | ||
113 | ) | ||
114 | } | 102 | } |
115 | 103 | ||
116 | listAbuseMessages (abuse: UserAbuse) { | 104 | listAbuseMessages (abuse: UserAbuse) { |
@@ -126,10 +114,7 @@ export class AbuseService { | |||
126 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages/' + abuseMessage.id | 114 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages/' + abuseMessage.id |
127 | 115 | ||
128 | return this.authHttp.delete(url) | 116 | return this.authHttp.delete(url) |
129 | .pipe( | 117 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
130 | map(this.restExtractor.extractDataBool), | ||
131 | catchError(res => this.restExtractor.handleError(res)) | ||
132 | ) | ||
133 | } | 118 | } |
134 | 119 | ||
135 | getPrefefinedReasons (type: AbuseFilter) { | 120 | getPrefefinedReasons (type: AbuseFilter) { |