Fix feedcomponent being initialized 2 times

master
Max 5 years ago
parent c61ccf617b
commit 4a2415b9e4

@ -39,6 +39,7 @@ export class FeedComponent implements OnInit {
}
ngOnInit() {
console.log('init feedcomponent');
this.data.currentUserInfo.subscribe(user => {
this.user = user;
this.loggedIn = user.loggedIn;
@ -55,7 +56,6 @@ export class FeedComponent implements OnInit {
this.loadingNew = response;
});
this.feedService.topPostsAvailable.subscribe(response => {
console.log(response);
this.loadingMostLiked = response;
});
}
@ -83,7 +83,6 @@ export class FeedComponent implements OnInit {
}
onScroll() {
console.log('scrolled');
this.feedService.getNextPosts();
}

@ -1,4 +1,5 @@
<div id="content" fxShow="true" fxHide.lt-md="true">
<!--on big screen-->
<div id="content" *ngIf="media.isActive('md') || media.isActive('lg')">
<div id="chat">
<home-chatmanager [hidden]="!loggedIn"></home-chatmanager>
</div>
@ -12,14 +13,9 @@
<home-search></home-search>
</div>
</div>
<!--
<mat-tab-group headerPosition="below" position="0" id="bottom-menu" fxShow="true" fxHide.gt-sm="true">
<mat-tab label="First"> <home-chatmanager ></home-chatmanager></mat-tab>
<mat-tab label="Second"><home-feed id="feed"></home-feed></mat-tab>
<mat-tab label="Third"> <home-social ></home-social></mat-tab>
</mat-tab-group>
-->
<div class="bottom-menu" fxShow="true" fxHide.gt-sm="true">
<!--on small screen-->
<div class="bottom-menu" *ngIf="media.isActive('sm') || media.isActive('xs')">
<mat-tab-group id="tab-group" selectedIndex="1" mat-stretch-tabs headerPosition="below">
<mat-tab disabled>
<ng-template mat-tab-label>

@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {DatasharingService} from 'src/app/services/datasharing.service';
import {FeedService} from 'src/app/services/feed/feed.service';
import { MediaObserver } from '@angular/flex-layout';
@Component({
selector: 'app-home',
@ -11,7 +11,7 @@ export class HomeComponent implements OnInit {
loggedIn: boolean;
constructor(private data: DatasharingService, private feedService: FeedService) {
constructor(private data: DatasharingService, public media: MediaObserver) {
}
ngOnInit() {

@ -151,6 +151,7 @@ export class FeedService {
}
public getPosts(sort: string) {
console.log('feedservice: getPosts()');
if ((sort === 'NEW' && this.newPosts.getValue().length === 0) ||
(sort === 'TOP' && this.mostLikedPosts.getValue().length === 0)) {
const headers = new Headers();

Loading…
Cancel
Save