Skip to content

Commit

Permalink
fix: sign out refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
fedeya committed Mar 4, 2023
1 parent 0f37109 commit 76391d8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion examples/full-example/src/components/Buttons.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
'use client';
import { signIn, signOut } from 'next-auth/react';
import { useRouter } from 'next/navigation';

export const SignInButton = () => {
return <button onClick={() => signIn('github')}>Sign In</button>;
};

export const SignOutButton = () => {
return <button onClick={() => signOut({ redirect: false })}>Sign Out</button>;
const router = useRouter();

const handleClick = async () => {
await signOut({ redirect: false });

router.refresh();
};

return <button onClick={handleClick}>Sign Out</button>;
};

0 comments on commit 76391d8

Please sign in to comment.