Add WS reconnect logic + connection indicator in calendar
- useHotelSocket: reconnect with exponential backoff (up to 30s), return connected state, log errors to console - BookingCalendar: show green/gray dot + Online/Offline label in toolbar - CalendarPage: pass wsConnected prop Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -49,7 +49,7 @@ export function CalendarPage() {
|
||||
}
|
||||
}, [])
|
||||
|
||||
const { send } = useHotelSocket({ slug, token: session?.token ?? null, onMessage: handleWsMessage })
|
||||
const { send, connected } = useHotelSocket({ slug, token: session?.token ?? null, onMessage: handleWsMessage })
|
||||
|
||||
const handleCreate = async (data: Partial<Booking>) => {
|
||||
try {
|
||||
@@ -134,6 +134,7 @@ export function CalendarPage() {
|
||||
locks={locks}
|
||||
onDraftStart={handleDraftStart}
|
||||
onDraftCancel={handleDraftCancel}
|
||||
wsConnected={connected}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user