From 023fdf5ee9b4119d7c0f64d2d743fa11fea99878 Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Wed, 15 Apr 2026 00:38:04 -0600 Subject: [PATCH] web fixes --- web/app/appointments/page.js | 4 ++-- web/app/cart/page.js | 3 +++ web/app/chat/page.js | 4 ++-- web/app/contact/page.js | 4 ++-- web/app/register/page.js | 3 +++ web/components/Navigation.js | 7 ++----- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/web/app/appointments/page.js b/web/app/appointments/page.js index 67170c59..78fd3d89 100644 --- a/web/app/appointments/page.js +++ b/web/app/appointments/page.js @@ -425,12 +425,12 @@ const canBookAppointments = user?.role === "CUSTOMER" || user?.role === "ADMIN"; }) .then((r) => r.json()) .then(setStores) - .catch(() => {}); + .catch(() => setError("Failed to load stores.")); fetch(`${API_BASE}/api/v1/services?size=100`) .then((r) => r.json()) .then((data) => setServices(data.content ?? [])) - .catch(() => {}); + .catch(() => setError("Failed to load services.")); fetch(`${API_BASE}/api/v1/pets?size=200&sort=id,asc&status=Available`) .then((r) => r.json()) diff --git a/web/app/cart/page.js b/web/app/cart/page.js index e555a5b2..344e50e7 100644 --- a/web/app/cart/page.js +++ b/web/app/cart/page.js @@ -43,6 +43,9 @@ function PaymentForm({ clientSecret, totalAmount, onSuccess, onCancel }) { try { await apiCompleteCheckout(token, paymentIntentId); } catch { + setPayError("Order confirmation failed. Please contact support."); + setPaying(false); + return; } onSuccess(); } diff --git a/web/app/chat/page.js b/web/app/chat/page.js index e54ea966..4d8d9314 100644 --- a/web/app/chat/page.js +++ b/web/app/chat/page.js @@ -57,7 +57,7 @@ function ChatPage() { } catch { - //Silent fail + setError("Failed to load messages."); } }, [token]); @@ -139,7 +139,7 @@ function ChatPage() { if (open) convId = open.id; } } catch { - // + setError("Failed to load conversations."); } } diff --git a/web/app/contact/page.js b/web/app/contact/page.js index 19295ebd..fa5c04ae 100644 --- a/web/app/contact/page.js +++ b/web/app/contact/page.js @@ -30,8 +30,8 @@ export default function ContactPage() {

General Contact

-

Email: support@petshop.com

-

Phone: (000) 000-0000

+

Email: hello@leonspetstore.com.au

+

Phone: (03) 9000 0000

Hours: Mon–Sat, 9:00 AM – 6:00 PM

diff --git a/web/app/register/page.js b/web/app/register/page.js index 674e4b9e..a5cd5b10 100644 --- a/web/app/register/page.js +++ b/web/app/register/page.js @@ -135,6 +135,8 @@ function RegisterPage() { value={form.phone} onChange={handleChange} required + pattern="[0-9\-\+\(\) ]{7,15}" + title="Enter a valid phone number" /> @@ -161,6 +163,7 @@ function RegisterPage() { value={form.confirmPassword} onChange={handleChange} required + minLength={6} autoComplete="new-password" /> diff --git a/web/components/Navigation.js b/web/components/Navigation.js index afd1ea50..39baa63a 100644 --- a/web/components/Navigation.js +++ b/web/components/Navigation.js @@ -15,14 +15,11 @@ export default function DisplayNav() { const [menuOpen, setMenuOpen] = useState(false); useEffect(() => { - if (!token) return; - fetch("/api/v1/stores?size=100", { - headers: { Authorization: `Bearer ${token}` }, - }) + fetch("/api/v1/stores?size=100") .then((r) => (r.ok ? r.json() : null)) .then((data) => { if (data) setStores(data.content ?? []); }) .catch(() => {}); - }, [token]); + }, []); function handleLogout() { logout();