fix(api): propagate requestId for register and reset-password

Backend requires X-Request-Id header from the verification code send
response. Wire requestId through email/auth-extra API returns, register
and forgot-password pages, and auth API request headers.
This commit is contained in:
zetaloop
2026-04-24 05:06:03 +08:00
parent e5fa8aa38b
commit 2ab075d173
5 changed files with 41 additions and 7 deletions
+9 -2
View File
@@ -29,6 +29,7 @@ const forgotSchema = z
export default function ForgotPasswordPage() {
const router = useRouter()
const [countdown, setCountdown] = useState(0)
const [requestId, setRequestId] = useState("")
const {
register,
@@ -52,7 +53,8 @@ export default function ForgotPasswordPage() {
try {
const email = getValues("email")
await sendForgotPasswordCode(email)
const rid = await sendForgotPasswordCode(email)
setRequestId(rid)
setCountdown(60)
notifySuccess("验证码已发送到你的邮箱")
} catch (err) {
@@ -62,7 +64,12 @@ export default function ForgotPasswordPage() {
const onSubmit = async (data: z.infer<typeof forgotSchema>) => {
try {
await resetPassword({ email: data.email, vcode: data.vcode, newPassword: data.newPassword })
await resetPassword({
email: data.email,
vcode: data.vcode,
newPassword: data.newPassword,
requestId,
})
notifySuccess("密码已重置")
router.push("/login")
} catch (err) {