perbaikan ui profile dan logout
This commit is contained in:
@@ -68,21 +68,6 @@
|
||||
"vm",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Profile",
|
||||
icon: "🧑",
|
||||
url: "/backoffice/profile",
|
||||
roles: [
|
||||
"it",
|
||||
"ga",
|
||||
"hr",
|
||||
"s&m",
|
||||
"office",
|
||||
"hm",
|
||||
"vm",
|
||||
"accounting",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Issues",
|
||||
icon: "📂",
|
||||
@@ -191,22 +176,6 @@
|
||||
url: "/backoffice/feedback",
|
||||
roles: ["it", "ga", "s&m", "office", "hm", "vm"],
|
||||
},
|
||||
{
|
||||
name: "Logout",
|
||||
icon: "🚪",
|
||||
url: "/logout",
|
||||
roles: [
|
||||
"it",
|
||||
"guest",
|
||||
"accounting",
|
||||
"ga",
|
||||
"hr",
|
||||
"s&m",
|
||||
"office",
|
||||
"hm",
|
||||
"vm",
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
let activeUrl = "/";
|
||||
@@ -222,13 +191,6 @@
|
||||
activeUrl = item.url;
|
||||
openMenus[item.name] = !openMenus[item.name];
|
||||
} else {
|
||||
if (item.url === "/logout") {
|
||||
if (confirm("Are you sure you want to logout?")) {
|
||||
logout();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
activeUrl = item.url;
|
||||
goto(item.url);
|
||||
}
|
||||
@@ -250,23 +212,6 @@
|
||||
)
|
||||
: undefined,
|
||||
}));
|
||||
|
||||
// logout
|
||||
async function logout() {
|
||||
const { error } = await supabase.auth.signOut();
|
||||
if (error) {
|
||||
console.error("Logout failed:", error.message);
|
||||
} else {
|
||||
localStorage.removeItem("user");
|
||||
|
||||
goto("/login");
|
||||
}
|
||||
}
|
||||
|
||||
// Handle logout click
|
||||
function handleLogoutClick() {
|
||||
logout();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="w-64 h-screen bg-white border-r shadow-sm">
|
||||
|
||||
Reference in New Issue
Block a user