|
|
@ -34,15 +34,25 @@ export class FeedComponent implements OnInit {
|
|
|
|
this.data.currentUserInfo.subscribe(user => {
|
|
|
|
this.data.currentUserInfo.subscribe(user => {
|
|
|
|
this.user = user;
|
|
|
|
this.user = user;
|
|
|
|
this.loggedIn = user.loggedIn;
|
|
|
|
this.loggedIn = user.loggedIn;
|
|
|
|
if (this.loggedIn) { this.userId = user.userID; }
|
|
|
|
if(this.loggedIn){
|
|
|
|
console.log('the userId is ' + this.userId);
|
|
|
|
this.userId = user.userID;
|
|
|
|
});
|
|
|
|
this.feedService.getAllPostsRawByUserId(this.userId).subscribe(response => {
|
|
|
|
this.feedService.getAllPostsRawByUserId(this.userId).subscribe(response => {
|
|
|
|
this.feedNew = this.feedService.renderAllPosts(response.json());
|
|
|
|
this.feedNew = this.feedService.renderAllPosts(response.json());
|
|
|
|
this.parentSelectedPostList = this.feedNew;
|
|
|
|
this.parentSelectedPostList = this.feedNew;
|
|
|
|
this.feedMostLiked = this.feedNew;
|
|
|
|
this.feedMostLiked = this.feedNew;
|
|
|
|
console.log(this.feedNew);
|
|
|
|
console.log(this.feedNew);
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.feedService.getAllPostsRaw().subscribe(response => {
|
|
|
|
|
|
|
|
this.feedNew = this.feedService.renderAllPosts(response.json());
|
|
|
|
|
|
|
|
this.parentSelectedPostList = this.feedNew;
|
|
|
|
|
|
|
|
this.feedMostLiked = this.feedNew;
|
|
|
|
|
|
|
|
console.log(this.feedNew);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
createPost(pElement) {
|
|
|
|
createPost(pElement) {
|
|
|
|