From 8fc9cc2d2d7db6d86ab00fb240e305a73b49e153 Mon Sep 17 00:00:00 2001 From: Vikas Nale Date: Mon, 31 Mar 2025 13:06:54 +0530 Subject: [PATCH] chnages for background env variables --- src/pages/authentication/LoginPage.jsx | 10 +++++----- src/utils/axiosClient.jsx | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pages/authentication/LoginPage.jsx b/src/pages/authentication/LoginPage.jsx index 6b51cee3..d82e55b3 100644 --- a/src/pages/authentication/LoginPage.jsx +++ b/src/pages/authentication/LoginPage.jsx @@ -25,9 +25,10 @@ const LoginPage = () => { })); }; - const handleSubmit = async ( e ) => - { - + const handleSubmit = async (e) => { + console.log(window._env_?.VITE_API_URL); + console.log(import.meta.env.VITE_API_URL); + e.preventDefault(); setLoading(true); @@ -39,13 +40,12 @@ const LoginPage = () => { const response = await AuthRepository.login(data); localStorage.setItem("jwtToken", response.data.token); - localStorage.setItem( "refreshToken", response.data.refreshToken ); + localStorage.setItem("refreshToken", response.data.refreshToken); setLoading(false); navigate("/dashboard"); } catch (err) { console.log("Unable to proceed. Please try again."); setLoading(false); - } }; return ( diff --git a/src/utils/axiosClient.jsx b/src/utils/axiosClient.jsx index 38f83248..3df8cbb2 100644 --- a/src/utils/axiosClient.jsx +++ b/src/utils/axiosClient.jsx @@ -5,6 +5,7 @@ import showToast from "../services/toastService"; const API_URL = window._env_?.VITE_API_URL || import.meta.env.VITE_API_URL; +console.log("API_URL" + API_URL); export const axiosClient = axios.create({ baseURL: API_URL, // Your Web API URL withCredentials: false, // Required if the API uses cookies @@ -18,6 +19,8 @@ axiosRetry(axiosClient, { retries: 3 }); // Request interceptor to add Bearer token axiosClient.interceptors.request.use( async (config) => { + console.log("Starting Request", JSON.stringify(config, null, 2)); + console.log("API_URL", API_URL); if (config.authRequired) { const token = localStorage.getItem("jwtToken"); if (token) {