diff --git a/README.md b/README.md index b800342..daaccec 100644 --- a/README.md +++ b/README.md @@ -108,10 +108,12 @@ This attribute allows you to pass a custom `fetch` implementation. In the following example we'll add a token to each fetch request that our Client sends to our GraphQL API. +> Note: fetchImp as third parameter is the default implementation based on environment. It is `fetch` API in browser and `make-fetch-happen` in node. + ```marko { + fetch=((resource, options, fetchImp) => { const token = getToken(); return fetch(resource, { ...options, diff --git a/src/components/gql-query/__tests__/__snapshots__/isomorphic-fetch-imp/renders.expected/loading.0.html b/src/components/gql-query/__tests__/__snapshots__/isomorphic-fetch-imp/renders.expected/loading.0.html new file mode 100644 index 0000000..d9eed76 --- /dev/null +++ b/src/components/gql-query/__tests__/__snapshots__/isomorphic-fetch-imp/renders.expected/loading.0.html @@ -0,0 +1,5 @@ +
+
\ No newline at end of file diff --git a/src/components/gql-query/__tests__/__snapshots__/isomorphic-fetch-imp/renders.expected/loading.1.html b/src/components/gql-query/__tests__/__snapshots__/isomorphic-fetch-imp/renders.expected/loading.1.html new file mode 100644 index 0000000..8a37fa4 --- /dev/null +++ b/src/components/gql-query/__tests__/__snapshots__/isomorphic-fetch-imp/renders.expected/loading.1.html @@ -0,0 +1,13 @@ +
+
+ \ No newline at end of file diff --git a/src/components/gql-query/__tests__/__snapshots__/isomorphic-fetch-imp/renders.expected/loading.2.html b/src/components/gql-query/__tests__/__snapshots__/isomorphic-fetch-imp/renders.expected/loading.2.html new file mode 100644 index 0000000..6f301af --- /dev/null +++ b/src/components/gql-query/__tests__/__snapshots__/isomorphic-fetch-imp/renders.expected/loading.2.html @@ -0,0 +1,9 @@ +
+ + Hello world! + +
+