| 50 | }; |
| 51 | |
| 52 | export const fetchGraphQL = async graphParams => { |
| 53 | const serializedParams = prepareGraphQLParams(graphParams); |
| 54 | const authToken = localStorage.getItem(socketOptions.authTokenName); |
| 55 | const currentHostUrl = hostUrl(); |
| 56 | const graphQLUrl = `${currentHostUrl}/graphql`; |
| 57 | const res = await fetch(graphQLUrl, { |
| 58 | method: 'post', |
| 59 | headers: { |
| 60 | 'Content-Type': 'application/json', |
| 61 | 'Authorization': `Bearer ${authToken}` |
| 62 | }, |
| 63 | body: serializedParams |
| 64 | }); |
| 65 | const resJSON = await res.json(); |
| 66 | const {data, errors} = resJSON; |
| 67 | return {data, error: getClientError(errors)}; |
| 68 | }; |
no test coverage detected