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

access cookie / localStorage #466

Open
Zerotask opened this issue Aug 21, 2023 · 2 comments
Open

access cookie / localStorage #466

Zerotask opened this issue Aug 21, 2023 · 2 comments

Comments

@Zerotask
Copy link

Zerotask commented Aug 21, 2023

I want to show a modal the first time a user logs in. Therefore I have a state in a cookie or localStorage, e. g. modalOpen which can either be missing or true and in these cases the modal should be shown. Afterwards it should set/update the cookie/localStorage, e. g. showModal=false

The specific action could be to add a css class (e. g. modal-open) or call an onclick modalId.showModal() (daisyUI)

@dz4k
Copy link
Collaborator

dz4k commented Aug 22, 2023

You can access localStorage as follows:

get localStorage.modalOpen
-- do stuff
set localStorage.modalOpen to value

@leandergangso
Copy link

this saved me :)
looks like this is not mentioned anywhere in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants