After looking at your code I am exactly sure you landed into the same issue as I did.
Look its related to how axios works:
On localhost:
1.
package.json : "proxy":"http://url.com"
and
2.
export default axios.create({
baseURL: "https://url",
});
would be sufficient for axios to be given relative paths such as:
const loginHandler = async (email, password) => {
try {
const response = await axios.post(
"/api/users/login",
{
email,
password,
},
{
headers: {
"Content-Type": "application/json",
},
}
);
But when hosted on Vercel it needs to be absolute path for now.
So basically in your axios calls replace the relative paths to that of Absolute paths and it should solve your problem:
const loginHandler = async (email, password) => {
try {
const response = await axios.post(
`https://url.vercel.app`+`/api/users/login`,
{
email,
password,
},
{
headers: {
"Content-Type": "application/json",
},
}
);