0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(core): fix next server action guide (#5179)

This commit is contained in:
wangsijie 2024-01-10 10:56:19 +08:00 committed by GitHub
parent cbc5dc5792
commit 4022e4dbc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,7 +63,7 @@ const config = {
cookieSecure: process.env.NODE_ENV === 'production', cookieSecure: process.env.NODE_ENV === 'production',
}; };
export const logtoClient = new LogtoClient(config);`} const logtoClient = new LogtoClient(config);`}
</code> </code>
</pre> </pre>
@ -181,8 +181,13 @@ type Props = {
export default function Callback({ searchParams }: Props) { export default function Callback({ searchParams }: Props) {
const router = useRouter(); const router = useRouter();
const redirectinRef = React.useRef(false);
useEffect(() => { useEffect(() => {
if (redirectinRef.current) {
return;
}
redirectinRef.current = true;
handleSignIn(searchParams).then(() => { handleSignIn(searchParams).then(() => {
router.push('/'); router.push('/');
}); });