Reading value from .env file is prepending domain url to the backend url #15684
Unanswered
nupurneogi
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@nupurneogi do not use double quote
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
.env file has
VITE_BACKEND_URL = "https://test.com/api"
In react typescript file,
let url = JSON.stringify(import.meta.env.VITE_BACKEND_URL);
const axiosInstance = axios.create({
baseURL :
${url}
,headers: headers
});
As seen in the network tab, the url shows
http://localhost:5100/%22https://test.com/api%22/user
instead of
https://test.com/api/user
Any help
Beta Was this translation helpful? Give feedback.
All reactions