29 lines
585 B
JavaScript
29 lines
585 B
JavaScript
import React from "react";
|
|
import ReactDOM from "react-dom/client";
|
|
import { GraphiQL } from "graphiql";
|
|
|
|
import "graphiql/graphiql.css";
|
|
|
|
const fetcher = async (params) => {
|
|
const res = await fetch(import.meta.env.VITE_GRAPHQL_ENDPOINT, {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify(params),
|
|
});
|
|
|
|
return res.json();
|
|
};
|
|
|
|
function App() {
|
|
return (
|
|
<GraphiQL
|
|
fetcher={fetcher}
|
|
defaultEditorToolsVisibility={true}
|
|
/>
|
|
);
|
|
}
|
|
|
|
ReactDOM.createRoot(document.getElementById("root")).render(<App />);
|