fix: login result handle changed to a singular function

This commit is contained in:
2025-08-21 14:36:07 +03:30
parent 4d84a29bda
commit 74fa41c1c0
6 changed files with 33 additions and 30 deletions

View File

@@ -5,7 +5,7 @@ import DigitInput from '@/components/DigitsInput';
import type { AuthMode, AuthType } from '../../types/authTypes';
import { useEffect, useState } from 'react';
import { AuthenticationCard } from '../AuthenticationCard';
import type { LoginRequest } from '../../types/userTypes';
import type { LoginRequest, LoginResult } from '../../types/userTypes';
import {
loginOrSignUpWithOtp,
sendEmailOtp,
@@ -23,8 +23,7 @@ interface OtpVerifyFormProps {
authType: AuthType;
authMode: AuthMode;
onEditValue: () => void;
onOTPVerified: (userId: GUID) => void;
onVerifyPhoneNumber: (userId: GUID) => void;
onOTPVerified: (loginResult: LoginResult) => void;
authReturnUrl: string;
}
@@ -35,7 +34,6 @@ export function OtpVerifyForm({
authMode,
onEditValue,
onOTPVerified,
onVerifyPhoneNumber,
authReturnUrl,
}: OtpVerifyFormProps) {
const [otpCode, setOtpCode] = useState<string>('');
@@ -118,11 +116,7 @@ export function OtpVerifyForm({
...tokenRes.data,
});
if (res.registeredWithOutPhoneNumber) {
onVerifyPhoneNumber(res.userId);
} else {
onOTPVerified(res.userId);
}
onOTPVerified(res);
toast({
message: