mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:46:29 +00:00
27 lines
712 B
TypeScript
27 lines
712 B
TypeScript
'use client'
|
|
|
|
import { FC, useState } from 'react';
|
|
import { Button } from '@/components/ui/button';
|
|
import { signOut } from 'next-auth/react';
|
|
import { LoaderCircle } from 'lucide-react';
|
|
|
|
type Props = {};
|
|
|
|
const Logout: FC<Props> = () => {
|
|
const [isLoading, setIsLoading] = useState(false);
|
|
|
|
const handleLogout = async () => {
|
|
setIsLoading(true);
|
|
signOut();
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<div className='block sm:hidden'>
|
|
<Button variant='destructive' className='w-full' disabled={isLoading} onClick={handleLogout}>{isLoading ? <LoaderCircle className='animate-spin' /> : null} Logout</Button>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default Logout; |