diff --git a/store/mutations.js b/store/mutations.js index 1d3339c1..00e9590e 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 a4f7df54..99cc7900 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: [] } });