Move code to create apollo instance

pull/5856/head
Angel Fernando Quiroz Campos 11 months ago
parent 9417429bdf
commit 976c59d307
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 10
      assets/vue/App.vue
  2. 14
      assets/vue/config/apolloClient.js

@ -41,7 +41,6 @@
import { computed, onMounted, onUpdated, provide, ref, watch, watchEffect } from "vue"
import { useRoute, useRouter } from "vue-router"
import { DefaultApolloClient } from "@vue/apollo-composable"
import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client/core"
import axios from "axios"
import { capitalize, isEmpty } from "lodash"
import ConfirmDialog from "primevue/confirmdialog"
@ -56,12 +55,7 @@ import CustomDashboardLayout from "../../var/vue_templates/components/layout/Das
import EmptyLayout from "./components/layout/EmptyLayout.vue"
import { useMediaElementLoader } from "./composables/mediaElementLoader"
const apolloClient = new ApolloClient({
link: createHttpLink({
uri: "/api/graphql",
}),
cache: new InMemoryCache(),
})
import apolloClient from "./config/apolloClient"
provide(DefaultApolloClient, apolloClient)
@ -192,5 +186,5 @@ watch(
onMounted(async () => {
mejsLoader()
await securityStore.checkSession()
});
})
</script>

@ -0,0 +1,14 @@
import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client/core"
const httpLink = createHttpLink({
uri: "/api/graphql",
})
const cache = new InMemoryCache()
const apolloClient = new ApolloClient({
link: httpLink,
cache,
})
export default apolloClient
Loading…
Cancel
Save