1 | import { transport } from './utils/transport.js';
|
2 |
|
3 | /**
|
4 | * [reachGraphQL Makes queres or mutations against GraphQL]
|
5 | * @param {[String]} path [path to the GraphQL server]
|
6 | * @param {[Object]} query [The query that GraphQL will use to fetch your data]
|
7 | * @param {[object]} queryParams = {} [Should contain object with different query params]
|
8 | * @return {[Object]} [Data that was queried or mutated]
|
9 | */
|
10 |
|
11 | export async function reachGraphQL (path, query, queryParams = {}) {
|
12 | try {
|
13 | return await transport(path, query, queryParams);
|
14 | } catch (error) {
|
15 | console.log(error)
|
16 | }
|
17 | }
|