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

Flash session persist #13

Open
jordyparker opened this issue May 7, 2021 · 1 comment
Open

Flash session persist #13

jordyparker opened this issue May 7, 2021 · 1 comment

Comments

@jordyparker
Copy link
Contributor

HI @zodman, I have been using this package for sometime now and +1. I get an error each time I share_flash to transmit it and it works fine but this error is persistent (like kind of remains in the session) and appears on all other requests.

I think setting request.session['share']['flash'] to {'success': False, 'error': False} after updating the variable props should work. Let me know you thoughs.

@girardinsamuel
Copy link
Contributor

girardinsamuel commented Feb 11, 2022

It should indeed be working yes !
That's what I have done in the default share method of the forked package of this repo I made. I am using it intensively in a project, and I need to maintain it and add features to it, so I made a fork.
Here are what you're talking about:
https://github.com/girardinsamuel/django-inertia/blob/v1.0.1/django_inertia/middleware.py#L61

We could also use the Django Messages module to have flash messages, but this is made for simple string message and it's not that easy to store JSON messages. (it requires to decode/encode them).

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

2 participants