30 lines
762 B
TypeScript
30 lines
762 B
TypeScript
import { Component, Input, OnInit } from '@angular/core';
|
|
import { Router } from '@angular/router';
|
|
|
|
@Component({
|
|
selector: 'app-sidebar',
|
|
standalone: false,
|
|
templateUrl: './sidebar.component.html',
|
|
styleUrls: ['./sidebar.component.css']
|
|
})
|
|
export class SidebarComponent implements OnInit {
|
|
@Input() isCollapsed: boolean = false; // รับค่าสถานะย่อ/ขยาย
|
|
|
|
userData: any = {
|
|
name: localStorage.getItem('usrthinam') + ' ' + localStorage.getItem('usrthilstnam'),
|
|
role: '',
|
|
avatar: ''
|
|
};
|
|
|
|
constructor(private router: Router) { }
|
|
|
|
ngOnInit(): void {
|
|
// โหลด User Data ถ้ามี
|
|
}
|
|
|
|
logout() {
|
|
localStorage.removeItem('access_token');
|
|
this.router.navigate(['/login']);
|
|
}
|
|
}
|