feat: implement authentication flow with login page, middleware protection, and session-based role management
This commit is contained in:
@@ -154,7 +154,20 @@ export default function Sidebar() {
|
||||
<p className="text-sm font-medium text-slate-700 truncate">Admin User</p>
|
||||
<p className="text-xs text-slate-400">admin@jaiben.com</p>
|
||||
</div>
|
||||
<button className="p-1.5 hover:bg-slate-100 rounded-lg">
|
||||
<button
|
||||
onClick={() => {
|
||||
// Import and call logout function
|
||||
// Note: We can't use client-only imports in server components directly
|
||||
// For now, we'll just clear sessionStorage and redirect
|
||||
if (typeof window !== 'undefined') {
|
||||
window.sessionStorage.removeItem('authToken');
|
||||
window.sessionStorage.removeItem('userRole');
|
||||
window.sessionStorage.removeItem('userName');
|
||||
window.location.href = '/login';
|
||||
}
|
||||
}}
|
||||
className="p-1.5 hover:bg-slate-100 rounded-lg"
|
||||
>
|
||||
<LogOut className="w-4 h-4 text-slate-400" />
|
||||
</button>
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user