Skip to main content
Glama
useConvexStatus.tsx1.01 kB
import useSWR from "swr"; import type { ConvexStatus, ConvexStatusIndicator, } from "lib/ConvexStatusWidget"; export type { ConvexStatus, ConvexStatusIndicator }; interface ConvexStatusResponse { status: { indicator: ConvexStatusIndicator; description: string; }; } /** * Hook to poll the Convex status page API and get current status information. * Polls every 30 seconds and on window focus (throttled to 30 seconds). */ export function useConvexStatus(): { status: ConvexStatus | undefined; } { const { data } = useSWR<ConvexStatusResponse>("/api/status", { refreshInterval: 1000 * 30, focusThrottleInterval: 1000 * 30, shouldRetryOnError: false, fetcher: convexStatusFetcher, }); return { status: data?.status, }; } const convexStatusFetcher = async ( url: string, ): Promise<ConvexStatusResponse> => { const res = await fetch(url); if (!res.ok) { throw new Error("Failed to fetch Convex status information."); } return res.json(); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/get-convex/convex-backend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server