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:
@@ -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("/")
|
||||
|
||||
Reference in New Issue
Block a user