Pattern question, client-side init() + is_logged_in cookie
#597
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hey @Thomanidas, thanks, glad this module helps!
It is indeed the way to go if you want to improve loading but there are some tricky things you should keep in mind. This cookie should be used only for non-sensitive UI which can be cached globally (no personal data, user names, etc). The main reason for this is that any user can set this cookie manually and uncover some part of your page which were not meant to be seen.
Yes, you can disable default module initialisation and set custom cookie on login call and delete it on logout, see Then I would define some composable like The pitfall here is that you cannot combine middleware to do the early return, like So, if you want to skip this, you would need to set some "default" user identity via
To sum up 😄 the best way probably to reduce the latency with your API (and potentially carefully cache it to speed up) but if you want to unlock pages without user-specfic data, this solution might work. |
Beta Was this translation helpful? Give feedback.

Hey @Thomanidas, thanks, glad this module helps!
It is indeed the way to go if you want to improve loading but there are some tricky things you should keep in mind. This cookie should be used only for non-sensitive UI which can be cached globally (no personal data, user names, etc). The main reason for this is that any user can set this cookie manually and uncover some part of your page which were not meant to be seen.