From 424aae99a0dc1d5dd7fc14e6d47c90f06c2f637b Mon Sep 17 00:00:00 2001 From: szewczyw Date: Tue, 18 Mar 2025 14:52:48 +0100 Subject: [PATCH] axios gets addres dynamically --- src/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 7857381..63c97c1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -49,10 +49,14 @@ watch ( }, {deep: true} ) +const currentUrl = window.location.href +export const baseURL = currentUrl.includes("localhost") + ? "https://zamowienia-test.mleczarnia-kuzma.pl/api" + : currentUrl.substring(0, currentUrl.lastIndexOf("/") ) + "/api" ; export const axiosInstance = axios.create({ - baseURL: 'https://zamowienia-test.mleczarnia-kuzma.pl/api', + baseURL: baseURL, withCredentials: true });