Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat: reinit gql client after login
Andrew Bastin6314740f46f5
diff --git a/packages/hoppscotch-app/helpers/backend/GQLClient.ts b/packages/hoppscotch-app/helpers/backend/GQLClient.tsindex 90027c265..1b01235fd 100644--- a/packages/hoppscotch-app/helpers/backend/GQLClient.ts+++ b/packages/hoppscotch-app/helpers/backend/GQLClient.ts@@ -69,7 +69,7 @@ authIdToken$.subscribe(() => {subscriptionClient.client.close()})-export const client = createClient({+const createHoppClient = () => createClient({url: BACKEND_GQL_URL,exchanges: [devtoolsExchange,@@ -125,6 +125,12 @@ export const client = createClient({],})+export const client = ref(createHoppClient())++authIdToken$.subscribe(() => {+ client.value = createHoppClient()+})+type MaybeRef<X> = X | Ref<X>type UseQueryOptions<T = any, V = object> = {@@ -192,7 +198,7 @@ export const useGQLQuery = <DocType, DocVarType, DocErrorType extends string>(watchEffect(() => {source.value = !isPaused.value- ? client.executeQuery<DocType, DocVarType>(request.value, {+ ? client.value.executeQuery<DocType, DocVarType>(request.value, {requestPolicy: "cache-and-network",}): undefined@@ -210,7 +216,7 @@ export const useGQLQuery = <DocType, DocVarType, DocErrorType extends string>(console.log("create sub")return wonkaPipe(- client.executeSubscription(sub),+ client.value.executeSubscription(sub),onEnd(() => {if (source.value) execute()}),@@ -307,6 +313,7 @@ export const runMutation = <TE.tryCatch(() =>client+ .value.mutation(mutation, variables, {requestPolicy: "cache-and-network",...additionalConfig,