diff options
| author | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-13 11:46:57 +0200 |
|---|---|---|
| committer | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-13 11:46:57 +0200 |
| commit | 2ea7a39c3f8eaf90ec28f8fd6fc465f215a0d99b (patch) | |
| tree | 12e948c76ad9ff1ad4fd8d365ea80290515aa942 /src/app/services | |
| parent | 531ce1bbda5f3909a0701b14377ae08b5c1993cb (diff) | |
| download | DevHive-Angular-2ea7a39c3f8eaf90ec28f8fd6fc465f215a0d99b.tar DevHive-Angular-2ea7a39c3f8eaf90ec28f8fd6fc465f215a0d99b.tar.gz DevHive-Angular-2ea7a39c3f8eaf90ec28f8fd6fc465f215a0d99b.zip | |
upVote functionality is finished
Diffstat (limited to 'src/app/services')
| -rw-r--r-- | src/app/services/rating.service.ts | 18 |
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); } } |
