diff --git a/src/app/components/about/about.component.ts b/src/app/components/about/about.component.ts index d2907cd..c891813 100644 --- a/src/app/components/about/about.component.ts +++ b/src/app/components/about/about.component.ts @@ -23,7 +23,7 @@ export class AboutComponent implements OnInit { @ViewChild(MatSort, {static: true}) sort: MatSort; ngOnInit() { - this.activityService.getActivitys(); + this.activityService.getActivities(); this.activityService.activitylist.subscribe(response => { this.actionlist = response; this.dataSource = new MatTableDataSource(this.actionlist.Actions); diff --git a/src/app/components/feed/feed.component.ts b/src/app/components/feed/feed.component.ts index 64efd5d..491b80d 100644 --- a/src/app/components/feed/feed.component.ts +++ b/src/app/components/feed/feed.component.ts @@ -38,7 +38,7 @@ export class FeedComponent implements OnInit { this.user = user; this.loggedIn = user.loggedIn; }); - this.activityService.getActivitys(); + this.activityService.getActivities(); this.activityService.activitylist.subscribe(response => { this.actionlist = response; }); diff --git a/src/app/components/feed/postlist/postlist.component.ts b/src/app/components/feed/postlist/postlist.component.ts index ec2e5f1..b16794d 100644 --- a/src/app/components/feed/postlist/postlist.component.ts +++ b/src/app/components/feed/postlist/postlist.component.ts @@ -22,18 +22,18 @@ export class PostlistComponent implements OnInit { voteUp(pPost: Post) { this.feedService.upvote(pPost.id).subscribe(response => { // this.voteEvent.emit(true); - pPost.userVote = response.json().data.vote.post.userVote; - pPost.upvotes = response.json().data.vote.post.upvotes; - pPost.downvotes = response.json().data.vote.post.downvotes; + pPost.userVote = response.data.vote.post.userVote; + pPost.upvotes = response.data.vote.post.upvotes; + pPost.downvotes = response.data.vote.post.downvotes; }); } voteDown(pPost: Post) { this.feedService.downvote(pPost.id).subscribe(response => { // this.voteEvent.emit(true); - pPost.userVote = response.json().data.vote.post.userVote; - pPost.upvotes = response.json().data.vote.post.upvotes; - pPost.downvotes = response.json().data.vote.post.downvotes; + pPost.userVote = response.data.vote.post.userVote; + pPost.upvotes = response.data.vote.post.upvotes; + pPost.downvotes = response.data.vote.post.downvotes; }); } diff --git a/src/app/services/activity/activity.service.ts b/src/app/services/activity/activity.service.ts index 4e4f43f..526bfd0 100644 --- a/src/app/services/activity/activity.service.ts +++ b/src/app/services/activity/activity.service.ts @@ -18,7 +18,7 @@ export class ActivityService { this.activitylist.next(pActivitylist); } - public getActivitys() { + public getActivities() { if (this.activitylist.getValue().Actions.length < 1) { const headers = new Headers(); headers.set('Content-Type', 'application/json'); diff --git a/src/app/services/feed/feed.service.ts b/src/app/services/feed/feed.service.ts index a516eb3..99217fe 100644 --- a/src/app/services/feed/feed.service.ts +++ b/src/app/services/feed/feed.service.ts @@ -14,9 +14,9 @@ export class FeedService { public newPostsAvailable = new BehaviorSubject(true); public topPostsAvailable = new BehaviorSubject(true); - public posts: BehaviorSubject = new BehaviorSubject(new Array()); - public newPosts: BehaviorSubject = new BehaviorSubject(new Array()); - public mostLikedPosts: BehaviorSubject = new BehaviorSubject(new Array()); + public posts: BehaviorSubject = new BehaviorSubject([]); + public newPosts: BehaviorSubject = new BehaviorSubject([]); + public mostLikedPosts: BehaviorSubject = new BehaviorSubject([]); private activePostList = 'NEW'; private mostLikedOffset = 0; private newOffset = 0; @@ -96,7 +96,7 @@ export class FeedService { }); } - public upvote(pPostID: number): any { + public upvote(postId: number): any { const headers = new Headers(); headers.set('Content-Type', 'application/json'); @@ -105,7 +105,7 @@ export class FeedService { post{userVote upvotes downvotes} } }`, variables: { - postId: pPostID + postId }}; return this.http.post(environment.graphQLUrl, body);