Refactor Apollo Client handling

This commit is contained in:
Andrew Bastin
2021-05-03 09:18:24 -04:00
parent b8bc110d33
commit 627811f28d
5 changed files with 104 additions and 31 deletions

View File

@@ -1,12 +0,0 @@
export default () => {
return {
httpEndpoint:
process.env.CONTEXT === "production"
? "https://api.hoppscotch.io/graphql"
: "https://api.hoppscotch.io/graphql",
wsEndpoint:
process.env.CONTEXT === "production"
? "wss://api.hoppscotch.io/graphql"
: "wss://api.hoppscotch.io/graphql",
}
}

15
plugins/vue-apollo.ts Normal file
View File

@@ -0,0 +1,15 @@
import Vue from "vue"
import VueApollo from "vue-apollo"
import { apolloClient } from "~/helpers/apollo";
const vueApolloProvider = new VueApollo({
defaultClient: apolloClient as any
});
Vue.use(VueApollo);
export default (ctx: any) => {
const { app } = ctx
app.apolloProvider = vueApolloProvider
}