aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vs/slnx.sqlitebin167936 -> 167936 bytes
-rw-r--r--src/app/services/rating.service.ts16
2 files changed, 16 insertions, 0 deletions
diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite
index 5dcda80..9e7e654 100644
--- a/.vs/slnx.sqlite
+++ b/.vs/slnx.sqlite
Binary files differ
diff --git a/src/app/services/rating.service.ts b/src/app/services/rating.service.ts
index 9403575..f3e3265 100644
--- a/src/app/services/rating.service.ts
+++ b/src/app/services/rating.service.ts
@@ -29,6 +29,13 @@ export class RatingService {
return this.putRatingRequest(userId, token, postId, isLike);
}
+ getRatingByUserAndPostWithSessionStorageRequest(postId: Guid): Observable<object> {
+ const userId = this._tokenService.getUserIdFromSessionStorageToken();
+ const token = this._tokenService.getTokenFromSessionStorage();
+
+ return this.getRatingByUserAndPostRequest(userId, token, postId);
+ }
+
createRatingRequest(userId: Guid, authToken: string, postId: Guid, isLike: boolean): Observable<object> {
const options = {
params: new HttpParams().set('UserId', userId.toString()),
@@ -53,4 +60,13 @@ export class RatingService {
return this._http.put(AppConstants.API_RATING_URL, body, options);
}
+
+ getRatingByUserAndPostRequest(userId: Guid, authToken: string, postId: Guid): Observable<object> {
+ const options = {
+ params: new HttpParams().set('UserId', userId.toString()).set('PostId', postId.toString()),
+ headers: new HttpHeaders().set('Authorization', 'Bearer ' + authToken)
+ };
+
+ return this._http.get(AppConstants.API_RATING_URL + 'GetByUserAndPost', options);
+ }
}