summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib/graphql.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-11-27 15:10:40 +0000
committerPhil Hughes <me@iamphill.com>2018-11-27 15:10:40 +0000
commit50e21a89a0009813b9f090288b22c64c5cefbd58 (patch)
tree7a142c12573f872f14ac366ec00082c650664592 /app/assets/javascripts/lib/graphql.js
parent15b4a8f93aaf313b8197ca381f529b00bd231a20 (diff)
downloadgitlab-ce-50e21a89a0009813b9f090288b22c64c5cefbd58.tar.gz
Suggests issues when typing title
This suggests possibly related issues when the user types a title. This uses GraphQL to allow the frontend to request the exact data that is requires. We also get free caching through the Vue Apollo plugin. With this we can include the ability to import .graphql files in JS and Vue files. Also we now have the Vue test utils library to make testing Vue components easier. Closes #22071
Diffstat (limited to 'app/assets/javascripts/lib/graphql.js')
-rw-r--r--app/assets/javascripts/lib/graphql.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/graphql.js b/app/assets/javascripts/lib/graphql.js
new file mode 100644
index 00000000000..20a0f142d9e
--- /dev/null
+++ b/app/assets/javascripts/lib/graphql.js
@@ -0,0 +1,9 @@
+import ApolloClient from 'apollo-boost';
+import csrf from '~/lib/utils/csrf';
+
+export default new ApolloClient({
+ uri: `${gon.relative_url_root}/api/graphql`,
+ headers: {
+ [csrf.headerKey]: csrf.token,
+ },
+});