2023-09-20 09:57:47 +07:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2023-09-18 08:50:13 +07:00
|
|
|
import { UserService } from 'src/app/core/services/user.service';
|
2023-09-20 09:57:47 +07:00
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
|
import { User } from 'src/app/core/models/user.model';
|
|
|
|
|
import { NgIf } from '@angular/common';
|
2023-09-21 14:33:43 +07:00
|
|
|
import { initFlowbite } from 'flowbite';
|
2023-09-18 08:50:13 +07:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-dashboard',
|
|
|
|
|
standalone: true,
|
2023-09-20 09:57:47 +07:00
|
|
|
imports: [NgIf],
|
2023-09-18 08:50:13 +07:00
|
|
|
templateUrl: './dashboard.component.html',
|
|
|
|
|
})
|
2023-09-20 09:57:47 +07:00
|
|
|
export class DashboardComponent implements OnInit {
|
|
|
|
|
userInfo: User | null = null;
|
|
|
|
|
|
2023-09-18 08:50:13 +07:00
|
|
|
constructor(private _userService: UserService) {}
|
|
|
|
|
|
2023-09-20 09:57:47 +07:00
|
|
|
ngOnInit(): void {
|
2023-09-21 14:33:43 +07:00
|
|
|
initFlowbite();
|
|
|
|
|
|
2023-09-20 09:57:47 +07:00
|
|
|
this._userService.currentUser.subscribe((user) => {
|
|
|
|
|
this.userInfo = user;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-18 08:50:13 +07:00
|
|
|
logout() {
|
|
|
|
|
console.log('logout');
|
|
|
|
|
this._userService.logout();
|
|
|
|
|
}
|
|
|
|
|
}
|