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
+4 -1
View File
@@ -40,6 +40,7 @@ export default function RegisterPage() {
const [showPassword, setShowPassword] = useState(false)
const [showConfirmPassword, setShowConfirmPassword] = useState(false)
const [countdown, setCountdown] = useState(0)
const [requestId, setRequestId] = useState("")
const {
register,
handleSubmit,
@@ -65,7 +66,8 @@ export default function RegisterPage() {
const email = String(getValues("email") ?? "")
try {
await sendEmailVerificationCode({ email, scene: "register" })
const rid = await sendEmailVerificationCode({ email, scene: "register" })
setRequestId(rid)
setCountdown(60)
notifySuccess("验证码已发送到你的邮箱")
} catch (err) {
@@ -80,6 +82,7 @@ export default function RegisterPage() {
email: data.email,
password: data.password,
vcode: data.vcode,
requestId,
})
storeLogin(user, ["consumer"])
router.push("/")