fix(auth): surface real OTP error on verification step

The booking login step showed only a generic error when /api/auth/token
returned 400, so an invalid or expired OTP looked like a broken page.
The backend returns the reason (ERR_AUTH_002 invalid / ERR_AUTH_003
expired) in errors[].message, forwarded by the route; show it via toast.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-15 16:37:50 +03:30
co-authored by Claude Opus 4.8
parent 232e7eaeb2
commit 65b3f56530
@@ -1,6 +1,7 @@
import { Button, CircularProgress } from "@mui/material";
import { request } from "@/services/response";
import Cookies from "js-cookie";
import { toast } from "react-toastify";
import { handleTimeExpiresToken } from "@/helper";
function SendReq({
@@ -26,10 +27,13 @@ function SendReq({
} else {
setLoading(false);
setIsError(true);
const message = response?.errors?.[0]?.message || "کد تأیید نادرست یا منقضی شده است.";
toast.error(message);
}
} catch {
setLoading(false);
setIsError(true);
toast.error("خطا در برقراری ارتباط. دوباره تلاش کنید.");
}
};