fix(auth): enable register tab switching

This commit is contained in:
Kirill
2026-05-22 15:59:38 +05:00
parent 237106f2a4
commit c903db439d
3 changed files with 13 additions and 4 deletions
+9 -1
View File
@@ -20,6 +20,7 @@ export function AuthPage() {
const [message, setMessage] = useState<string | null>(null)
const [oauthError, setOauthError] = useState<string | null>(null)
const [tab, setTab] = useState(0)
const [isRegister, setIsRegister] = useState(false)
const [showForgot, setShowForgot] = useState(false)
const [searchParams, setSearchParams] = useSearchParams()
const navigate = useNavigate()
@@ -122,6 +123,7 @@ export function AuthPage() {
}}
onClick={() => {
setTab(idx)
if (idx === 0) setIsRegister(false)
setMessage(null)
setOauthError(null)
}}
@@ -142,7 +144,13 @@ export function AuthPage() {
</Alert>
)}
{tab === 0 && <AuthPasswordForm isRegister={false} onSuccess={() => navigate('/', { replace: true })} />}
{tab === 0 && (
<AuthPasswordForm
isRegister={isRegister}
onRegisterChange={setIsRegister}
onSuccess={() => navigate('/', { replace: true })}
/>
)}
{tab === 1 && <AuthCodeForm onSuccess={() => navigate('/', { replace: true })} />}
<Box sx={{ mt: 2, mb: 1, display: 'flex', justifyContent: 'center' }}>