Skip to content

Commit

Permalink
Merge pull request #141 from cvazquezlos/sergio2
Browse files Browse the repository at this point in the history
Sergio2
  • Loading branch information
Blay93 authored Apr 19, 2017
2 parents 6e934b4 + a641c41 commit 9ec7023
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions frontend/src/app/component/public/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, OnInit} from '@angular/core';
import {Component, OnInit, DoCheck} from '@angular/core';
import {STATUS_NO_CONTENT, BOOKS_IMG_URL} from "../../../util";
import {DomSanitizer} from '@angular/platform-browser';

Expand All @@ -17,7 +17,7 @@ import {UserService} from '../../../service/user.service';
templateUrl: 'home.component.html'
})

export class HomeComponent implements OnInit {
export class HomeComponent implements OnInit, DoCheck {

books: Resource[];
booksPage: number;
Expand Down Expand Up @@ -55,6 +55,12 @@ export class HomeComponent implements OnInit {
this.user = this.userService.getUserCompleted();
}

ngDoCheck() {
if (this.isLogged != this.sessionService.checkCredentials()) {
this.ngOnInit();
}
}

addBooks(userReq: boolean) {
this.resourceService.getAllResources('Libro', this.booksPage).subscribe(
books => {
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/app/component/public/user/profile.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, OnInit, EventEmitter, Output, ViewChild} from '@angular/core';
import {Component, OnInit, EventEmitter, Output, ViewChild, DoCheck} from '@angular/core';
import {Router} from '@angular/router';
import 'rxjs/Rx';
import {DomSanitizer} from '@angular/platform-browser';
Expand All @@ -19,7 +19,7 @@ import {ModalBiographyEdit} from "./modal.biography.component/modal-biography-ed
@Component({
templateUrl: 'profile.component.html'
})
export class ProfileComponent implements OnInit {
export class ProfileComponent implements OnInit, DoCheck {

currentActions: Action[];
currentActionsPage: number;
Expand Down Expand Up @@ -91,6 +91,12 @@ export class ProfileComponent implements OnInit {
}
}

ngDoCheck() {
if(this.user != this.userService.getUserCompleted()){
this.ngOnInit();
}
}

downloadImages(resources: Resource[]) {
console.log('Downloading images from server...');
for (let resource of resources) {
Expand Down

0 comments on commit 9ec7023

Please sign in to comment.