Skip to content

Commit

Permalink
Added logout button and clear cache button
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen-Gordon committed Apr 6, 2024
1 parent 13a8674 commit e518432
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion src/app/@auth/(.)settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,53 @@ import {
DrawerTitle,
} from '@/app/components/ui/drawer';
import { Button } from '@/app/components/ui/button';

import SendNotification from '@/app/components/SendNotification/SendNotification';

import { useLogout } from '@privy-io/react-auth';

// next
import { useSearchParams } from 'next/navigation';
import { useRouter } from 'next/navigation';
import { usePrivySmartAccount } from '@zerodev/privy';

export default function Page() {

// const { logout } = usePrivySmartAccount()

const router = useRouter();


const { logout } = useLogout({
onSuccess: () => {
console.log('User logged out');
router.push('/login');
localStorage.clear();
// Any logic you'd like to execute after a user successfully logs out
},
});

return (
<>
<SendNotification />
<div className='grid space-y-6 p-4'>
<SendNotification />
<Button
variant={'destructive'}
onClick={() => {
logout();
}}
>
Log out
</Button>
<Button
variant={'destructive'}
onClick={() => {
localStorage.clear();
}}
>
Clear Local Storage
</Button>
</div>
</>
);
}

0 comments on commit e518432

Please sign in to comment.