/** * Shared GraphQL client for all MPR UI apps. */ const GRAPHQL_URL = "/api/graphql"; export async function gql( query: string, variables?: Record, ): Promise { const response = await fetch(GRAPHQL_URL, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ query, variables }), }); const json = await response.json(); if (json.errors?.length) { throw new Error(json.errors[0].message); } return json.data as T; }