shahriarsajeeb / Eshop-tutorial

https://eshop-tutorial.vercel.app
817 stars 280 forks source link

Login and signup functionality is not working #5

Open abhijha0602 opened 1 year ago

abhijha0602 commented 1 year ago

everything connected successfuly but login and signup form is not redirecting to the any page after submiting the form it is giving cors error

Hengc0de commented 8 months ago

I know this is late but if in your terminal it says: error: file is not defined, but in CONSOLE it says CORS error it is actually not the CORS causing the error it is the multer problem in the filename section filename: function (req, res, cb) { const uniqueSuffix = Date.now() + "-" + Math.round(Math.random() + 1e9); const filename = file.originalname.split(".")[0]; cb(null, filename + "-" + uniqueSuffix + ".png"); },

here just change the res to file:

filename: function (req, file, cb) {
    const uniqueSuffix = Date.now() + "-" + Math.round(Math.random() + 1e9);
    const filename = file.originalname.split(".")[0];
    cb(null, filename + "-" + uniqueSuffix + ".png");
},

and it should works