chnages for background env variables
This commit is contained in:
parent
0ad38baa99
commit
8fc9cc2d2d
@ -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();
|
e.preventDefault();
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@ -39,13 +40,12 @@ const LoginPage = () => {
|
|||||||
|
|
||||||
const response = await AuthRepository.login(data);
|
const response = await AuthRepository.login(data);
|
||||||
localStorage.setItem("jwtToken", response.data.token);
|
localStorage.setItem("jwtToken", response.data.token);
|
||||||
localStorage.setItem( "refreshToken", response.data.refreshToken );
|
localStorage.setItem("refreshToken", response.data.refreshToken);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
navigate("/dashboard");
|
navigate("/dashboard");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Unable to proceed. Please try again.");
|
console.log("Unable to proceed. Please try again.");
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
@ -5,6 +5,7 @@ import showToast from "../services/toastService";
|
|||||||
|
|
||||||
const API_URL = window._env_?.VITE_API_URL || import.meta.env.VITE_API_URL;
|
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({
|
export const axiosClient = axios.create({
|
||||||
baseURL: API_URL, // Your Web API URL
|
baseURL: API_URL, // Your Web API URL
|
||||||
withCredentials: false, // Required if the API uses cookies
|
withCredentials: false, // Required if the API uses cookies
|
||||||
@ -18,6 +19,8 @@ axiosRetry(axiosClient, { retries: 3 });
|
|||||||
// Request interceptor to add Bearer token
|
// Request interceptor to add Bearer token
|
||||||
axiosClient.interceptors.request.use(
|
axiosClient.interceptors.request.use(
|
||||||
async (config) => {
|
async (config) => {
|
||||||
|
console.log("Starting Request", JSON.stringify(config, null, 2));
|
||||||
|
console.log("API_URL", API_URL);
|
||||||
if (config.authRequired) {
|
if (config.authRequired) {
|
||||||
const token = localStorage.getItem("jwtToken");
|
const token = localStorage.getItem("jwtToken");
|
||||||
if (token) {
|
if (token) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user