in my app.js
useEffect(() => {
axios.defaults.headers.common["token"] =
process.env.REACT_APP_SITE_TOKEN;
axios.defaults.baseURL = "https://api.example.com";
}, []);
in my redux action file:
export const getCollectionByToken = (token) => async (dispatch) => {
console.log(axios.defaults); //logs https://api.exapmle.com
try {
const res = await axios.get("/collections/" + token);
console.log(res);
dispatch({ type: SET_CURRENT_COLLECTION, payload: res.data });
...
but somehow, the requests are going to http://localhost:3000/collection/<token>