feat: DWH connectivity probe at startup — modal alert within 5s if unreachable
Backend: GET /health/dwh (unauthenticated) calls tht db ping with a 5s timeout. Frontend: checkDwhHealth() races a 5s timer against the fetch; on failure a non-dismissable Dialog with Retry appears immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -53,3 +53,15 @@ export const deleteSession = (id: string) =>
|
||||
|
||||
export const getSessionDocuments = (id: string) =>
|
||||
apiFetch<SessionDocument[]>(`/sessions/${id}/documents`);
|
||||
|
||||
export async function checkDwhHealth(): Promise<{ ok: boolean }> {
|
||||
const timeout = new Promise<{ ok: false }>((r) => setTimeout(() => r({ ok: false }), 5000));
|
||||
try {
|
||||
return await Promise.race([
|
||||
apiFetch<{ ok: boolean; detail: string }>("/health/dwh"),
|
||||
timeout,
|
||||
]);
|
||||
} catch {
|
||||
return { ok: false };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user