Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
at main 40 lines 977 B view raw
1import { ArrowRightStartOnRectangleIcon } from "@heroicons/react/24/outline"; 2import cn from "@/helpers/cn"; 3import errorToast from "@/helpers/errorToast"; 4import reloadAllTabs from "@/helpers/reloadAllTabs"; 5import { signOut } from "@/store/persisted/useAuthStore"; 6 7interface LogoutProps { 8 className?: string; 9 onClick?: () => void; 10} 11 12const Logout = ({ className = "", onClick }: LogoutProps) => { 13 const handleLogout = async () => { 14 try { 15 signOut(); 16 reloadAllTabs(); 17 } catch (error) { 18 errorToast(error); 19 } 20 }; 21 22 return ( 23 <button 24 className={cn( 25 "flex w-full items-center space-x-1.5 px-2 py-1.5 text-left text-gray-700 text-sm dark:text-gray-200", 26 className 27 )} 28 onClick={async () => { 29 await handleLogout(); 30 onClick?.(); 31 }} 32 type="button" 33 > 34 <ArrowRightStartOnRectangleIcon className="size-4" /> 35 <div>Logout</div> 36 </button> 37 ); 38}; 39 40export default Logout;