Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot remove Falsy cookies #58

Closed
Heziode opened this issue Mar 14, 2020 · 4 comments
Closed

Cannot remove Falsy cookies #58

Heziode opened this issue Mar 14, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@Heziode
Copy link

Heziode commented Mar 14, 2020

I trying to remove "falsy" cookies (cookies that contains 0, or false), but I cannot.

I think this is due to:

if (cookie) state.set(name, '', opts)

Current workaround: set a non "falsy" value to be removable.

@microcipcip
Copy link
Owner

microcipcip commented Mar 16, 2020

@Heziode can I see the code you've used for setting up the cookie? I think you may be right though, I'll check the code when I have the time, thanks for reporting this.

@microcipcip microcipcip added the bug Something isn't working label Mar 16, 2020
@Heziode
Copy link
Author

Heziode commented Mar 16, 2020

Example from my project where I encountered the problem:

Example of setting (here is a boolean value):
https://github.com/FOE-Tools/FOE-Tools.github.io/blob/def39c7b0202f0a9fb2a843eaecd7332ecfe92f9/components/gb-investment/script.js#L507-L510

Example of deletion:
https://github.com/FOE-Tools/FOE-Tools.github.io/blob/8bb36dea80656ea164b1b4d320aa6cde3db31fea/layouts/_default/script.js#L340-L351

I have some cookies that can have a "falsy" value depending of user preferences.

@microcipcip
Copy link
Owner

Hi @Heziode, I have updated the cookie library with the fix. Can you please close this issue if it works?

@Heziode
Copy link
Author

Heziode commented Mar 17, 2020

Thank's @microcipcip, it works.

@Heziode Heziode closed this as completed Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants