| 123456789101112131415161718192021 |
- import {Environment, Network, RecordSource, Store} from 'relay-runtime';
- function fetchQuery(operation, variables): Promise<void> {
- return fetch('/api/graphql', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- query: operation.text,
- variables,
- }),
- }).then((response): Promise<void> => response.json());
- }
- const environment = new Environment({
- network: Network.create(fetchQuery),
- store: new Store(new RecordSource()),
- });
- export default environment;
|