Struggling with passing environment variables in Axios patch request
const axios = require("axios");
export const handleSubmit = async (formValue, uniquePageName) => {
await axios
.patch(process.env.INTERNAL_RETAILER_CONFIG_UPDATE, formValue, {
headers: {
"Access-Control-Allow-Origin": process.env.INTERNAL_RETAILER_CONFIG_UPDATE,
"x-auth-token": process.env.INTERNAL_TOKEN,
retailername: uniquePageName,
"Content-Type": "application/json",
},
})
.then((res) => {
return res.data;
})
.catch((error) => {
console.log(error);
});
};
Moved the function to the api folder and triggering it on form submit button. Error displayed in console.