chnages for background env variables
This commit is contained in:
parent
0ad38baa99
commit
8fc9cc2d2d
@ -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 (
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user