chnages for background env variables

This commit is contained in:
Vikas Nale 2025-03-31 13:06:54 +05:30
parent 0ad38baa99
commit 8fc9cc2d2d
2 changed files with 8 additions and 5 deletions

View File

@ -25,8 +25,9 @@ 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 (

View File

@ -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) {