I have a create-react-app using react-router-dom and axios
The application contains a route
/view-details/:planId/:itemId
When application navigates to the above mentioned path, the api request is prefixed with above mentioned like follows
https://localhost:3000/view-details/1/api/details
instead it should have been
https://localhost:3000/api/details
I haven’t configured the baseURL in axios, so I am assuming its empty. This issue occurs only when there is a param in browser path. I believe the issue is not with axios configuration since some images also contain the path like https://localhost:3000/view-details/1/assets/img/img.png
instead of https://localhost:3000/assets/img/img.png
Below is my package.json
{ "name": "my-app", "version": "0.1.0", "private": true, "proxy": "http://localhost:5000", // omitted scrips, dependencies and irrelevant setup }
Solution tried:
updated "homepage": "/"
in package.json -> didn’t work
So, I am not sure if I am missing anything in configuration.