aboutsummaryrefslogtreecommitdiff
path: root/src/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/services')
-rw-r--r--src/app/services/rating.service.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/app/services/rating.service.ts b/src/app/services/rating.service.ts
index f3e3265..58ff1f4 100644
--- a/src/app/services/rating.service.ts
+++ b/src/app/services/rating.service.ts
@@ -36,6 +36,13 @@ export class RatingService {
return this.getRatingByUserAndPostRequest(userId, token, postId);
}
+ deleteRatingFromSessionStorageRequest(ratingId: Guid): Observable<object> {
+ const userId = this._tokenService.getUserIdFromSessionStorageToken();
+ const token = this._tokenService.getTokenFromSessionStorage();
+
+ return this.deleteRatingRequest(userId, token, ratingId);
+ }
+
createRatingRequest(userId: Guid, authToken: string, postId: Guid, isLike: boolean): Observable<object> {
const options = {
params: new HttpParams().set('UserId', userId.toString()),
@@ -67,6 +74,15 @@ export class RatingService {
headers: new HttpHeaders().set('Authorization', 'Bearer ' + authToken)
};
- return this._http.get(AppConstants.API_RATING_URL + 'GetByUserAndPost', options);
+ return this._http.get(AppConstants.API_RATING_URL + '/GetByUserAndPost', options);
+ }
+
+ deleteRatingRequest(userId: Guid, authToken: string, ratingId: Guid): Observable<object> {
+ const options = {
+ params: new HttpParams().set('UserId', userId.toString()).set('RatingId', ratingId.toString()),
+ headers: new HttpHeaders().set('Authorization', 'Bearer ' + authToken)
+ };
+
+ return this._http.delete(AppConstants.API_RATING_URL, options);
}
}