From 65b3f56530aed8651f9c8ff88782820916ecd538 Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Mon, 15 Jun 2026 16:37:50 +0330 Subject: [PATCH] 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 --- components/register/verificationPage/SendReq.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/register/verificationPage/SendReq.js b/components/register/verificationPage/SendReq.js index b75c301..d384c76 100644 --- a/components/register/verificationPage/SendReq.js +++ b/components/register/verificationPage/SendReq.js @@ -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("خطا در برقراری ارتباط. دوباره تلاش کنید."); } };