From 6de3e4dfdac07088b80a640f1c26eff6d66a76cb Mon Sep 17 00:00:00 2001 From: Romain Verger Date: Thu, 3 Mar 2022 17:16:07 +0100 Subject: [PATCH] Ajout prenom page d'accueil --- src/app/pages/home-page/home-page.component.html | 3 +-- src/app/pages/home-page/home-page.component.scss | 7 +++++++ src/app/pages/home-page/home-page.component.ts | 14 ++++++++++++-- src/app/pages/models/user.ts | 4 ++-- src/app/pages/resto-page/resto-page.component.ts | 1 - 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/app/pages/home-page/home-page.component.html b/src/app/pages/home-page/home-page.component.html index 68c67ae..aadcb86 100644 --- a/src/app/pages/home-page/home-page.component.html +++ b/src/app/pages/home-page/home-page.component.html @@ -1,2 +1 @@ -

Hello :D

- +

Hello {{userName}} !

diff --git a/src/app/pages/home-page/home-page.component.scss b/src/app/pages/home-page/home-page.component.scss index e69de29..bbc89ce 100644 --- a/src/app/pages/home-page/home-page.component.scss +++ b/src/app/pages/home-page/home-page.component.scss @@ -0,0 +1,7 @@ +#demotext { + color: #FFFFFF; + background: #912C22; + text-shadow: 0 0 10px #FFFFFF; + color: #FFFFFF; + background: #912C22; + } \ No newline at end of file diff --git a/src/app/pages/home-page/home-page.component.ts b/src/app/pages/home-page/home-page.component.ts index 95509ba..3cbf7bd 100644 --- a/src/app/pages/home-page/home-page.component.ts +++ b/src/app/pages/home-page/home-page.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { ApiBackService } from 'src/app/services/api-back.service'; +import { TokenService } from 'src/app/services/token.service'; @Component({ selector: 'app-home-page', @@ -8,15 +9,24 @@ import { ApiBackService } from 'src/app/services/api-back.service'; }) export class HomePageComponent implements OnInit { + public userName : any; - constructor(private apiBackService : ApiBackService) { + constructor(private apiBackService : ApiBackService, private tokenService : TokenService) { } ngOnInit(): void { + this.apiBackService.getPersonneById(this.tokenService.getCurrentUserId()).subscribe( + user =>{ + + this.userName = user.prenom; + + + + }) +} - } onEventLike(isLiked : boolean) { this.apiBackService.restoLiked$.next(isLiked); } diff --git a/src/app/pages/models/user.ts b/src/app/pages/models/user.ts index ca281f8..87c6596 100644 --- a/src/app/pages/models/user.ts +++ b/src/app/pages/models/user.ts @@ -1,6 +1,6 @@ -export interface User { +export interface User { id?:number; - firstName: string; + prenom: string; lastName: string; email: string; password?: string; diff --git a/src/app/pages/resto-page/resto-page.component.ts b/src/app/pages/resto-page/resto-page.component.ts index caf6e22..50aaee7 100644 --- a/src/app/pages/resto-page/resto-page.component.ts +++ b/src/app/pages/resto-page/resto-page.component.ts @@ -81,7 +81,6 @@ export class RestoPageComponent implements OnInit { if(listRestauIdLike.includes(restau.id)) - //console.log(restau); restau.restauLike = true; });