Log out with pageContext.user
and once
#2583
Unanswered
itsdyzoon
asked this question in
Help & Questions
Replies: 1 comment 5 replies
-
I see (and the docs should be updated to mention this). Can you confirm the following? pageContext.globalContext.user = null
console.log(pageContext.user === null) // Logs true Why doesn't it solve the issue? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm following the Vike auth guide to implement custom authentication. I’ve successfully handled login using a server-side
onCreatePageContext()
and passed theuser
to the client withonce
enabled. Now I’m trying to implement a logout mechanism.I call an API endpoint that invalidates the session (stored in cookies). After that, I want the UI to reflect that the user is logged out.
I tried setting
pageContext.user = null
orpageContext.globalContext.user = null
, but the values do not update themselves, not to mention the UI.I also tried calling
reload()
(with and without setting the above), but it doesn't seem to help.Is there a way to update
pageContext.user
after logout (and re-render the UI accordingly) without reloading the entire page from the server?Beta Was this translation helpful? Give feedback.
All reactions