TKK_E32231405/components/logout-button.tsx

31 lines
770 B
TypeScript

'use client'
import { logout } from '@/app/actions'
import { Button } from '@/components/ui/button'
import { LogOut } from 'lucide-react'
import { showSwal } from '@/lib/swal'
export function LogoutButton() {
const handleLogout = async () => {
const result = await showSwal.confirm(
'Keluar?',
'Apakah Anda yakin ingin mengakhiri sesi ini?'
)
if (result.isConfirmed) {
logout()
}
}
return (
<Button
variant="outline"
onClick={handleLogout}
className="gap-2 border-black bg-white text-black hover:bg-gray-100 hover:text-black transition-colors"
>
<LogOut className="h-4 w-4" />
Logout
</Button>
)
}