Ajout prenom page d'accueil

This commit is contained in:
Romain Verger 2022-03-03 17:16:07 +01:00
parent 7aa95ef99a
commit 6de3e4dfda
5 changed files with 22 additions and 7 deletions

View File

@ -1,2 +1 @@
<h1>Hello :D</h1> <h1 style = "text-align: center;">Hello {{userName}} !</h1>

View File

@ -0,0 +1,7 @@
#demotext {
color: #FFFFFF;
background: #912C22;
text-shadow: 0 0 10px #FFFFFF;
color: #FFFFFF;
background: #912C22;
}

View File

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ApiBackService } from 'src/app/services/api-back.service'; import { ApiBackService } from 'src/app/services/api-back.service';
import { TokenService } from 'src/app/services/token.service';
@Component({ @Component({
selector: 'app-home-page', selector: 'app-home-page',
@ -8,15 +9,24 @@ import { ApiBackService } from 'src/app/services/api-back.service';
}) })
export class HomePageComponent implements OnInit { export class HomePageComponent implements OnInit {
public userName : any;
constructor(private apiBackService : ApiBackService) { constructor(private apiBackService : ApiBackService, private tokenService : TokenService) {
} }
ngOnInit(): void { ngOnInit(): void {
this.apiBackService.getPersonneById(this.tokenService.getCurrentUserId()).subscribe(
user =>{
this.userName = user.prenom;
})
} }
onEventLike(isLiked : boolean) { onEventLike(isLiked : boolean) {
this.apiBackService.restoLiked$.next(isLiked); this.apiBackService.restoLiked$.next(isLiked);
} }

View File

@ -1,6 +1,6 @@
export interface User { export interface User {
id?:number; id?:number;
firstName: string; prenom: string;
lastName: string; lastName: string;
email: string; email: string;
password?: string; password?: string;

View File

@ -81,7 +81,6 @@ export class RestoPageComponent implements OnInit {
if(listRestauIdLike.includes(restau.id)) if(listRestauIdLike.includes(restau.id))
//console.log(restau); //console.log(restau);
restau.restauLike = true; restau.restauLike = true;
}); });