| 130 | }; |
| 131 | |
| 132 | const handleResendVerification = async () => { |
| 133 | setResendingEmail(true); |
| 134 | try { |
| 135 | const token = localStorage.getItem('token'); |
| 136 | const res = await fetch('/api/auth/resend-verification', { |
| 137 | method: 'POST', |
| 138 | headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }, |
| 139 | body: JSON.stringify({ email: user?.email }), |
| 140 | }); |
| 141 | if (!res.ok) { const err = await res.json().catch(() => ({ detail: 'Failed' })); throw new Error(err.detail); } |
| 142 | showMsg(isChinese ? '验证邮件已发送,请查收' : 'Verification email sent. Please check your inbox.'); |
| 143 | } catch (e: any) { showMsg(e.message || 'Failed', 'error'); } |
| 144 | setResendingEmail(false); |
| 145 | }; |
| 146 | |
| 147 | const handleChangePassword = async () => { |
| 148 | if (!oldPassword || !newPassword) { showMsg(isChinese ? '请填写所有密码字段' : 'Fill all password fields', 'error'); return; } |