Files
micro-frontend/ng-ttc-frontend/src/app/component/sidebar/sidebar.component.ts

30 lines
762 B
TypeScript
Raw Normal View History

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