From 6b1304f37ba85a7fdcd4a8693522995d52d9242e Mon Sep 17 00:00:00 2001 From: diced Date: Mon, 8 Sep 2025 23:06:27 -0700 Subject: [PATCH] fix: #885 --- src/client/pages/auth/register.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/pages/auth/register.tsx b/src/client/pages/auth/register.tsx index b3efedb6..3f8c0d0a 100644 --- a/src/client/pages/auth/register.tsx +++ b/src/client/pages/auth/register.tsx @@ -1,5 +1,6 @@ import { Response } from '@/lib/api/response'; import { fetchApi } from '@/lib/fetchApi'; +import { useTitle } from '@/lib/hooks/useTitle'; import { Button, Center, @@ -18,10 +19,9 @@ import { useForm } from '@mantine/form'; import { notifications, showNotification } from '@mantine/notifications'; import { IconLogin, IconPlus, IconUserPlus, IconX } from '@tabler/icons-react'; import { useEffect, useState } from 'react'; -import { Link, redirect, useLocation, useNavigate } from 'react-router-dom'; +import { Link, useLocation, useNavigate } from 'react-router-dom'; import useSWR, { mutate } from 'swr'; import GenericError from '../../error/GenericError'; -import { useTitle } from '@/lib/hooks/useTitle'; export function Component() { useTitle('Register'); @@ -73,7 +73,7 @@ export function Component() { (async () => { const res = await fetch('/api/user'); if (res.ok) { - redirect('/dashboard'); + navigate('/dashboard'); } else { setLoading(false); } @@ -83,7 +83,7 @@ export function Component() { useEffect(() => { if (!config) return; - if (!config?.features.userRegistration) { + if (!config?.features.userRegistration && !code) { navigate('/auth/login'); } }, [code, config]); @@ -122,7 +122,7 @@ export function Component() { }); mutate('/api/user'); - redirect('/dashboard'); + navigate('/dashboard'); } };