Second frontend, written in Next.JS + Typescript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
804 B

{"ast":null,"code":"import compress from \"gql-compress\";\n\nclass GQLBrowserClient {\n async post(query, variables, operationName) {\n const res = await fetch(`/api/graphql`, {\n method: \"POST\",\n body: JSON.stringify({\n query,\n variables,\n operationName\n }),\n credentials: \"include\",\n headers: {\n \"Content-Type\": \"application/json\"\n }\n });\n const json = await res.json();\n\n if (json.errors) {\n throw new Error(`${json.errors[0].message} (${json.errors[0].path})`);\n }\n\n return json.data;\n }\n\n}\n\nexport function gql(a) {\n return compress(a.join(\"\"));\n}\nconst gqlBrowserClient = new GQLBrowserClient();\nexport default gqlBrowserClient;","map":null,"metadata":{},"sourceType":"module"}