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

Redirect after clear #348

Open
BeSaad opened this issue Feb 11, 2025 · 3 comments
Open

Redirect after clear #348

BeSaad opened this issue Feb 11, 2025 · 3 comments

Comments

@BeSaad
Copy link
Contributor

BeSaad commented Feb 11, 2025

Currently I have to do

const { clear } = useUserSession()

const onLogoutClick = async () => {
  await clear()
  router.push('/')
}

Im wondering If I can do better

sessionHooks.hook('clear', async (session, event) => {}) is not enough

@BeSaad
Copy link
Contributor Author

BeSaad commented Feb 11, 2025

Even worst Im forced to do

const { loggedIn } = useUserSession()
watch(loggedIn, () => {
  if (!loggedIn.value) {
    router.push('/')
  }
})

If I want to handle the case I clear the session from the backend after refresh of access token fails

@BilalShah3
Copy link

watch(loggedIn, () => {
if (!loggedIn.value) {
router.push('/')
}
})

but loggedIn is not reactive when you change the route through navigation unless you refresh the page.

@BeSaad
Copy link
Contributor Author

BeSaad commented Feb 12, 2025

watch(loggedIn, () => {
if (!loggedIn.value) {
router.push('/')
}
})

but loggedIn is not reactive when you change the route through navigation unless you refresh the page.

Im not getting you sorry
For me Its doing the job

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