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