From 55de93ce57b79f8cd4c64c48af3f052efb3df5af Mon Sep 17 00:00:00 2001 From: Rike Date: Mon, 15 Apr 2024 14:11:22 +0200 Subject: [PATCH] fix: api host url for all envs --- frontend/src/helpers/api.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frontend/src/helpers/api.js b/frontend/src/helpers/api.js index f3048a4..cbdfe19 100644 --- a/frontend/src/helpers/api.js +++ b/frontend/src/helpers/api.js @@ -1,11 +1,8 @@ -let host; -if (process.env.NODE_ENV === "development") { - host = "http://localhost:3001" -} else { - host = "/" -} +const host = `${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}`; export async function login(values) { + console.log(host) + const requestOptions = { method: "POST", headers: {