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:
@@ -6,13 +6,16 @@
|
||||
*/
|
||||
import { io, Socket } from "socket.io-client";
|
||||
|
||||
// Connect directly to backend to avoid Vite's WS proxy failing on upgrade,
|
||||
// which causes an unhandled AggregateError from engine.io's Promise.any() probe.
|
||||
const SOCKET_URL =
|
||||
import.meta.env.VITE_API_BASE_URL_BACKEND ||
|
||||
(typeof window !== "undefined" ? window.location.origin : "");
|
||||
import.meta.env.VITE_API_BASE_URL_BACKEND || "http://localhost:5000";
|
||||
|
||||
export const socket: Socket = io(SOCKET_URL, {
|
||||
withCredentials: true,
|
||||
autoConnect: true,
|
||||
reconnectionAttempts: 5,
|
||||
reconnectionDelay: 2000,
|
||||
});
|
||||
|
||||
socket.on("connect", () => {
|
||||
@@ -22,3 +25,7 @@ socket.on("connect", () => {
|
||||
socket.on("disconnect", () => {
|
||||
console.log("[socket] disconnected");
|
||||
});
|
||||
|
||||
socket.on("connect_error", (err) => {
|
||||
console.warn("[socket] connection error:", err.message);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user