MCPcopy
hub / github.com/mattkrick/meatier / fetchGraphQL

Function fetchGraphQL

src/universal/utils/fetching.js:52–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50};
51
52export 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};

Callers 6

loginUserFunction · 0.90
loginTokenFunction · 0.90
signupUserFunction · 0.90
emailPasswordResetFunction · 0.90
resetPasswordFunction · 0.90
verifyEmailFunction · 0.90

Calls 3

prepareGraphQLParamsFunction · 0.85
hostUrlFunction · 0.85
getClientErrorFunction · 0.85

Tested by

no test coverage detected