39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import {Component, inject} from '@angular/core';
|
|
import {Title} from "@angular/platform-browser";
|
|
import {UserStoreService} from "../../../infrastructure/services/user-store.service";
|
|
import {AuthService} from "../../../infrastructure/services/auth-service";
|
|
|
|
@Component({
|
|
selector: 'app-user-dashboard',
|
|
imports: [],
|
|
templateUrl: './user-dashboard.component.html',
|
|
styleUrl: './user-dashboard.component.scss',
|
|
})
|
|
export class UserDashboardComponent {
|
|
public username!: string;
|
|
public email!: string;
|
|
public userId!: number;
|
|
userStore = inject(UserStoreService);
|
|
private authenticateService = inject(AuthService);
|
|
title = inject(Title)
|
|
|
|
constructor() {
|
|
//TODO App Name
|
|
this.title.setTitle('User Dashboard | App Name');
|
|
}
|
|
ngOnInit(): void {
|
|
this.userStore.getUsernameFromStore()
|
|
.subscribe(val => {
|
|
const usernameFromToken = this.authenticateService.getUsernameFromToken();
|
|
this.username = val || usernameFromToken
|
|
});
|
|
|
|
this.userStore.getEmailFromStore()
|
|
.subscribe(val => {
|
|
const emailFromToken = this.authenticateService.getEmailFromToken();
|
|
this.email = val || emailFromToken
|
|
});
|
|
|
|
}
|
|
}
|