feat: support guest session (#919)
This commit is contained in:
parent
24cb2ce19b
commit
9279135355
34 changed files with 741 additions and 288 deletions
|
|
@ -9,6 +9,7 @@ import { SubmitButton } from '@/components/submit-button';
|
|||
|
||||
import { register, type RegisterActionState } from '../actions';
|
||||
import { toast } from '@/components/toast';
|
||||
import { useSession } from 'next-auth/react';
|
||||
|
||||
export default function Page() {
|
||||
const router = useRouter();
|
||||
|
|
@ -23,6 +24,8 @@ export default function Page() {
|
|||
},
|
||||
);
|
||||
|
||||
const { update: updateSession } = useSession();
|
||||
|
||||
useEffect(() => {
|
||||
if (state.status === 'user_exists') {
|
||||
toast({ type: 'error', description: 'Account already exists!' });
|
||||
|
|
@ -37,6 +40,7 @@ export default function Page() {
|
|||
toast({ type: 'success', description: 'Account created successfully!' });
|
||||
|
||||
setIsSuccessful(true);
|
||||
updateSession();
|
||||
router.refresh();
|
||||
}
|
||||
}, [state]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue