diff --git a/pages/graphql.vue b/pages/graphql.vue index 2473d66c2..aad171cf9 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -136,7 +136,6 @@ export default { }, data() { return { - url: "https://rickandmortyapi.com/graphql", schemaString: "", queryFields: [], mutationFields: [], @@ -144,6 +143,16 @@ export default { gqlTypes: [] }; }, + computed: { + url: { + get() { + return this.$store.state.gql.url; + }, + set(value) { + this.$store.commit("setGQLState", { value, attribute: "url" }); + } + } + }, methods: { copySchema() { const aux = document.createElement("textarea"); diff --git a/store/mutations.js b/store/mutations.js index 37473e4b9..1d3339c16 100644 --- a/store/mutations.js +++ b/store/mutations.js @@ -3,6 +3,10 @@ export default { state.request[object.attribute] = object.value }, + setGQLState(state, object) { + state.gql[object.attribute] = object.value; + }, + addHeaders(state, value) { state.request.headers.push(value); }, diff --git a/store/state.js b/store/state.js index 487623fff..a4f7df544 100644 --- a/store/state.js +++ b/store/state.js @@ -16,5 +16,8 @@ export default () => ({ rawInput: false, requestType: '', contentType: '', + }, + gql: { + url: 'https://rickandmortyapi.com/graphql' } });