From ddac0aee6551fd0b62b2eff42044e00611023e50 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 5 Aug 2019 10:39:40 +0200 Subject: [PATCH] Don't use compile-time defined URLs, just use window.location This allows to use a single front-end on two different instances, and will allow us redistribute the front-end as Elixir releases Signed-off-by: Thomas Citharel --- js/src/api/_entrypoint.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/src/api/_entrypoint.ts b/js/src/api/_entrypoint.ts index ff2558d33..16de19cd8 100644 --- a/js/src/api/_entrypoint.ts +++ b/js/src/api/_entrypoint.ts @@ -5,7 +5,7 @@ * * Example: framameet.org */ -export const MOBILIZON_INSTANCE_HOST = process.env.MOBILIZON_INSTANCE_HOST; +export const MOBILIZON_INSTANCE_HOST = window.location.hostname; /** * URL on which the API is. "/api" will be added at the end @@ -14,7 +14,7 @@ export const MOBILIZON_INSTANCE_HOST = process.env.MOBILIZON_INSTANCE_HOST; * * Example: https://framameet.org */ -export const GRAPHQL_API_ENDPOINT = process.env.GRAPHQL_API_ENDPOINT; +export const GRAPHQL_API_ENDPOINT = window.location.origin; /** * URL with path on which the API is. Replaces GRAPHQL_API_ENDPOINT if used @@ -23,4 +23,4 @@ export const GRAPHQL_API_ENDPOINT = process.env.GRAPHQL_API_ENDPOINT; * * Example: https://framameet.org/api */ -export const GRAPHQL_API_FULL_PATH = process.env.GRAPHQL_API_FULL_PATH; +export const GRAPHQL_API_FULL_PATH = `${window.location.origin}/api`;