fix: pass token when resetting password

This commit is contained in:
Stephen Zhou 2025-01-17 22:31:58 +08:00
parent b21d92629f
commit eb47ec2cca
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -50,7 +50,12 @@ export function Component() {
const navigate = useNavigate()
const updateMutation = useMutation({
mutationFn: async (values: z.infer<typeof initPasswordFormSchema>) => {
const res = await resetPassword({ newPassword: values.newPassword })
const token = new URLSearchParams(window.location.search).get("token")
if (!token) {
throw new Error("Token not found")
}
const res = await resetPassword({ newPassword: values.newPassword, token })
const error = res.error?.message
if (error) {
throw new Error(error)