feat: 修复弹窗失败问题
This commit is contained in:
@@ -18,6 +18,18 @@ export default function VerificationCodeInput({
|
||||
colorScheme = "green",
|
||||
isRequired = true
|
||||
}) {
|
||||
// 包装 onSendCode,确保所有错误都被捕获,防止被 ErrorBoundary 捕获
|
||||
const handleSendCode = async () => {
|
||||
try {
|
||||
if (onSendCode) {
|
||||
await onSendCode();
|
||||
}
|
||||
} catch (error) {
|
||||
// 错误已经在父组件处理,这里只需要防止未捕获的 Promise rejection
|
||||
console.error('Send code error (caught in VerificationCodeInput):', error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<FormControl isRequired={isRequired} isInvalid={!!error}>
|
||||
<HStack>
|
||||
@@ -30,7 +42,7 @@ export default function VerificationCodeInput({
|
||||
/>
|
||||
<Button
|
||||
colorScheme={colorScheme}
|
||||
onClick={onSendCode}
|
||||
onClick={handleSendCode}
|
||||
isDisabled={countdown > 0 || isLoading}
|
||||
isLoading={isSending}
|
||||
minW="120px"
|
||||
|
||||
Reference in New Issue
Block a user