fix: resolve appointment form validation and socket connection issues

- Fix status enum in browser.ts (uppercase → lowercase values)
- Fix date validation (z.string → z.coerce.date) so form accepts Date objects
- Add missing type/userId/title fields to browser.ts appointment schema
- Replace nested PatientSearch Select with simple inline Input to fix patient selection
- Fix mutationFn to throw on non-ok responses so backend errors surface correctly
- Connect socket.io directly to backend (port 5000) instead of Vite proxy to fix AggregateError on startup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gitead
2026-04-23 23:30:08 -04:00
parent 4f8a211bf1
commit a279a3e7c1
5 changed files with 287 additions and 91 deletions

View File

@@ -274,7 +274,9 @@ export default function AppointmentsPage() {
"/api/appointments/upsert",
appointment
);
return await res.json();
const body = await res.json();
if (!res.ok) throw new Error(body?.message || "Failed to create appointment");
return body;
},
onSuccess: (appointment) => {
toast({