How to remove cookies from web-application when user is logged out

in this article we will see how to remove cookies (from module js-cookies)

Step 1: Remove a Cookie

To remove a cookie, use the(“Cookies.remove") method. You need to pass the name of the cookie you want to delete. Optionally, you can specify additional attributes (like path) if the cookie was set with specific attributes.

Basic Removal

// Remove a cookie named 'example'
Cookies.remove('example');

Removal with Path

If the cookie was set with a specific path, you need to specify the same path when removing it:

// Remove a cookie named 'example' set with a specific path
Cookies.remove('example', { path: '/' });

Leave a comment

Your email address will not be published. Required fields are marked *