bendotcodes / cookies

Load and save cookies within your Web application
MIT License
150 stars 17 forks source link

CORS error during cookie.remove after close and reopen the page #261

Closed kvasko closed 3 years ago

kvasko commented 4 years ago

Hi, I set a cookie with expiration time (30 minutes). I created logout function to remove the cookie if the user would like to logout from the system. Everything is working fine till I am not closing and reopening the page. In this case when I try to logout than I am getting "Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development." error. The cookies.remove deleted the cookie but the page throws the above mentioned error. I commented out cookies.remove line and the error was gone so I think this is causing this issue. This is my code which handle the remove call: return result.then((result) => { if (result.status === 'SUCCESS') { cookies.remove('Session',{ path: '/'}); } else { this.SweetAlert.Message(result, 'warning'); } }).catch((error) => { this.SweetAlert.Message(error, 'warning'); }); I would appreciate any help to fix this.

eXon commented 3 years ago

Just cleaning up old bugs, let me know if it's still an issue.