From 122782f244d4259380d86cf557c001d98bfba672 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Kalloor Biju Date: Mon, 25 Nov 2019 19:19:21 +0000 Subject: [PATCH 1/3] Added headers field to state and added mutations to handle header list updates --- store/mutations.js | 16 ++++++++++++++++ store/state.js | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/store/mutations.js b/store/mutations.js index 1d3339c16..00e9590ee 100644 --- a/store/mutations.js +++ b/store/mutations.js @@ -7,6 +7,22 @@ export default { state.gql[object.attribute] = object.value; }, + addGQLHeader(state, object) { + state.gql.headers.push(object); + }, + + removeGQLHeader(state, index) { + state.gql.headers.splice(index, 1); + }, + + setGQLHeaderKey(state, object) { + state.gql.headers[object.index].key = object.value; + }, + + setGQLHeaderValue(state, object) { + state.gql.headers[object.index].value = object.value; + }, + addHeaders(state, value) { state.request.headers.push(value); }, diff --git a/store/state.js b/store/state.js index a4f7df544..99cc7900b 100644 --- a/store/state.js +++ b/store/state.js @@ -18,6 +18,7 @@ export default () => ({ contentType: '', }, gql: { - url: 'https://rickandmortyapi.com/graphql' + url: 'https://rickandmortyapi.com/graphql', + headers: [] } }); From 146df237f240496e42b070b882691dfb60fe2127 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 25 Nov 2019 22:48:36 -0500 Subject: [PATCH 2/3] Added Headers for GraphQL requests --- pages/graphql.vue | 109 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/pages/graphql.vue b/pages/graphql.vue index 2add7ddce..70e7768a7 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -25,6 +25,82 @@ + +
    +
  • +
    + +
    + +
    +
    + +
  • +
+
    +
  • + +
  • +
  • + +
  • +
    +
  • + +
  • +
    +
+
    +
  • + +
  • +
+
+
@@ -156,9 +232,13 @@