UNPKG

@wener/console

Version:
16 lines (15 loc) 581 B
import { getSiteStore } from "../../console/context.js"; export function getGraphQLUrl() { var url = typeof window === "undefined" ? "http://127.0.0.1:3000/graphql" : "/graphql"; var site = getSiteStore().getState(); if (typeof process === "undefined") { url = site.graphqlUrl || url; } else { url = site.graphqlUrl || process.env.GRAPHQL_URL || process.env.NEXT_PUBLIC_GRAPHQL_URL || url; } if (url.startsWith("/") && typeof window !== "undefined") { url = "".concat(window.location.origin).concat(url); } return url; }