Skip to content

Commit 1eb0883

Browse files
committedDec 27, 2020
Add apollo client
1 parent c39c1df commit 1eb0883

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed
 

‎apollo.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
client: {
3+
service: {
4+
name: 'guide-api',
5+
url: 'https://api.graphql.guide/graphql'
6+
},
7+
includes: ['src/**/*.vue', 'src/**/*.js']
8+
}
9+
}

‎src/App.vue

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@
44
</template>
55

66
<script>
7+
import { ApolloClient, InMemoryCache } from '@apollo/client/core'
8+
import { DefaultApolloClient } from '@vue/apollo-composable'
9+
import { provide } from 'vue'
10+
11+
const client = new ApolloClient({
12+
uri: 'https://api.graphql.guide/graphql',
13+
cache: new InMemoryCache()
14+
})
15+
716
export default {
8-
name: 'App'
17+
name: 'App',
18+
setup() {
19+
provide(DefaultApolloClient, client)
20+
}
921
}
1022
</script>

0 commit comments

Comments
 (0)
Please sign in to comment.