aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-03-27 08:11:00 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-03-27 08:11:00 +0200
commitb563125ae8c57d36590c6c18f03ac9354695fc1a (patch)
tree0a9d24fe5698f0db02e56819d4d107e40c4765a3 /src
parent1f3ce144043359d7b00178fbbb3c38163071f040 (diff)
downloadDevHive-Angular-b563125ae8c57d36590c6c18f03ac9354695fc1a.tar
DevHive-Angular-b563125ae8c57d36590c6c18f03ac9354695fc1a.tar.gz
DevHive-Angular-b563125ae8c57d36590c6c18f03ac9354695fc1a.zip
Updated some outdates style subscriptions in post component
Diffstat (limited to 'src')
-rw-r--r--src/app/components/post/post.component.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/app/components/post/post.component.ts b/src/app/components/post/post.component.ts
index e1e593a..c4d64ed 100644
--- a/src/app/components/post/post.component.ts
+++ b/src/app/components/post/post.component.ts
@@ -172,8 +172,8 @@ export class PostComponent implements OnInit, AfterViewInit {
return;
}
- this._ratingServe.getRatingByUserAndPostWithSessionStorageRequest(Guid.parse(this.paramId)).subscribe(
- (x: object) => {
+ this._ratingServe.getRatingByUserAndPostWithSessionStorageRequest(Guid.parse(this.paramId)).subscribe({
+ next: (x: object) => {
if (Object.values(x)[3] === isLike) {
this.deleteRating(Object.values(x)[0], isLike);
@@ -185,37 +185,37 @@ export class PostComponent implements OnInit, AfterViewInit {
this.changeColorOfVoteButton(isLike, !isLike);
}
},
- () => {
+ error: () => {
this.createRating(isLike);
this.changeColorOfVoteButton(isLike, !isLike);
}
- );
+ });
}
private createRating(isLike: boolean): void {
- this._ratingServe.createRatingWithSessionStorageRequest(Guid.parse(this.paramId), isLike).subscribe(
- () => {
+ this._ratingServe.createRatingWithSessionStorageRequest(Guid.parse(this.paramId), isLike).subscribe({
+ next: () => {
this.votesNumber += -1 + Number(isLike) * 2;
}
- );
+ });
}
private putRating(isLike: boolean): void {
- this._ratingServe.putRatingWithSessionStorageRequest(Guid.parse(this.paramId), isLike).subscribe(
- () => {
+ this._ratingServe.putRatingWithSessionStorageRequest(Guid.parse(this.paramId), isLike).subscribe({
+ next: () => {
// when false -2 + 0 wjen true -2 + 4
this.votesNumber += -2 + Number(isLike) * 4;
}
- );
+ });
}
private deleteRating(ratingId: string, isLike: boolean): void {
- this._ratingServe.deleteRatingFromSessionStorageRequest(Guid.parse(ratingId)).subscribe(
- () => {
+ this._ratingServe.deleteRatingFromSessionStorageRequest(Guid.parse(ratingId)).subscribe({
+ next: () => {
this.votesNumber += 1 - Number(isLike) * 2;
}
- );
+ });
}
private changeColorOfVoteButton(isUpvoted: boolean, isDownvoted: boolean): void {