From efd692db90fe2f5c8c35914edee9d06757c50f0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20HUSS?= <theophile.huss@etu.unistra.fr> Date: Fri, 6 Dec 2024 15:49:10 +0100 Subject: [PATCH] fix: Show username when user is connected --- .../modules/profile/profile-info/profile-info.component.html | 2 +- .../modules/profile/profile-info/profile-info.component.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/modules/profile/profile-info/profile-info.component.html b/src/app/modules/profile/profile-info/profile-info.component.html index 09eb058..f81beee 100644 --- a/src/app/modules/profile/profile-info/profile-info.component.html +++ b/src/app/modules/profile/profile-info/profile-info.component.html @@ -12,7 +12,7 @@ src="https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_1280.png" alt="profile picture" /> - <h3>User Name</h3> + <h3>{{ username }}</h3> </div> <hr /> <div class="profile_stats"> diff --git a/src/app/modules/profile/profile-info/profile-info.component.ts b/src/app/modules/profile/profile-info/profile-info.component.ts index f534187..0081079 100644 --- a/src/app/modules/profile/profile-info/profile-info.component.ts +++ b/src/app/modules/profile/profile-info/profile-info.component.ts @@ -11,6 +11,7 @@ import { UserService } from '../../../services/user.service'; export class ProfileInfoComponent implements OnInit { quizList: any[] = []; isLogged: boolean = false; + username: string = 'Anonymous'; constructor(private router: Router, private cookieService: CookieService, private userSerivce: UserService) {} ngOnInit(): void { @@ -31,8 +32,9 @@ export class ProfileInfoComponent implements OnInit { { title: 'Quiz 14', content: 'Quiz 14 Content' }, { title: 'Quiz 15', content: 'Quiz 15 Content' }, ]; - this.userSerivce.getMe().subscribe((data) => { + this.userSerivce.getMe().subscribe((data: any) => { this.isLogged = true; + this.username = data.username; }); } -- GitLab