MCPcopy Create free account
hub / github.com/codelitdev/courselit / queryGraphQLWithUIEffects

Function queryGraphQLWithUIEffects

packages/app/lib/utils.js:31–45  ·  view source on GitHub ↗
(
  backend,
  dispatch,
  networkAction,
  token
)

Source from the content-addressed store, hash-verified

29export const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
30
31export const queryGraphQLWithUIEffects = (
32 backend,
33 dispatch,
34 networkAction,
35 token
36) => async (query) => {
37 try {
38 dispatch(networkAction(false));
39 const response = await queryGraphQL(`${backend}/graph`, query, token);
40
41 return response;
42 } finally {
43 dispatch(networkAction(false));
44 }
45};
46
47export const formattedLocaleDate = (epochString) =>
48 new Date(Number(epochString)).toLocaleString("en-US");

Callers 1

useExecuteGraphQLQueryFunction · 0.90

Calls 2

networkActionFunction · 0.85
queryGraphQLFunction · 0.85

Tested by

no test coverage detected