Vue.js apollo graphql将请求发送到本地主机,而不是发送到特定端点

Vue.js apollo graphql将请求发送到本地主机,而不是发送到特定端点,vue.js,graphql,apollo,Vue.js,Graphql,Apollo,我配置了一个多客户端vue apollo,但由于某些原因,它只向本地主机发送请求。但是,我从未指定过localhost端点。这是我的配置文件 vue-apollo.js: import Vue from "vue"; import VueApollo from "vue-apollo"; import { createApolloClient, restartWebsockets } from "vue-cli-plugin-apoll

我配置了一个多客户端vue apollo,但由于某些原因,它只向本地主机发送请求。但是,我从未指定过localhost端点。这是我的配置文件
vue-apollo.js:

import Vue from "vue";
import VueApollo from "vue-apollo";

import {
  createApolloClient,
  restartWebsockets
} from "vue-cli-plugin-apollo/graphql-client";

Vue.use(VueApollo);
const AUTH_TOKEN = "apollo-token";
const httpsEndpoint =
  process.env.VUE_APP_GRAPHQL_HTTPS || "https://myst.endpoint.prod/graphql";

export const filesRoot =
  process.env.VUE_APP_FILES_ROOT ||
  httpsEndpoint.substr(0, httpsEndpoint.indexOf("/graphql"));

Vue.prototype.$filesRoot = filesRoot;


const defaultOptions = {

  httpsEndpoint,

  wssEndpoint:
    process.env.VUE_APP_GRAPHQL_WSS || "wss://myst.endpoint.prod/graphql",

  tokenName: AUTH_TOKEN,

  persisting: false,

  websocketsOnly: false,

  ssr: false
};
const clientAOptions = {
  httpsEndpoint: "https://myst.endpoint.prod/graphql"
};
const clientBOptions = {
  httpsEndpoint: "https://mynd.endpoint.prod/graphql"
};

export function createProvider(options = {}) {

  const createA = createApolloClient({
    ...defaultOptions,
    ...clientAOptions
  });
  const createB = createApolloClient({
    ...defaultOptions,
    ...clientBOptions
  });

  const a = createA.apolloClient;
  const b = createB.apolloClient;


  const apolloProvider = new VueApollo({
    clients: {
      a,
      b
    },
    defaultClient: a,
    defaultOptions: {
      $query: {
      
      }
    },
    errorHandler(error) {

      console.log(
        "%cError",
        "background: red; color: white; padding: 2px 4px; border-radius: 3px; font-weight: bold;",
        error.message
      );
    }
  });

  return apolloProvider;
}


export async function onLogin(apolloClient, token) {
  if (typeof localStorage !== "undefined" && token) {
    localStorage.setItem(AUTH_TOKEN, token);
  }
  if (apolloClient.wsClient) restartWebsockets(apolloClient.wsClient);
  try {
    await apolloClient.resetStore();
  } catch (e) {

    console.log("%cError on cache reset (login)", "color: orange;", e.message);
  }
}


export async function onLogout(apolloClient) {
  if (typeof localStorage !== "undefined") {
    localStorage.removeItem(AUTH_TOKEN);
  }
  if (apolloClient.wsClient) restartWebsockets(apolloClient.wsClient);
  try {
    await apolloClient.resetStore();
  } catch (e) {
    
    console.log("%cError on cache reset (logout)", "color: orange;", e.message);
  }
}
我根据文档编辑了这个文件。阿波罗为什么向错误的端点发送请求,以及如何修复它?我根据文档编辑了这个文件。阿波罗为什么向错误的端点发送请求,以及如何修复它? 我根据文档编辑了这个文件。阿波罗为什么向错误的端点发送请求,以及如何修复它