migration(vuex): currentRoute is now a ref

This commit is contained in:
axolotle 2024-03-18 16:46:23 +01:00
parent 2156196f8b
commit 6be1609f10

View file

@ -158,16 +158,17 @@ export default {
commit('SET_YUNOHOST_INFOS', null)
},
DISCONNECT({ dispatch }, route = router.currentRoute) {
DISCONNECT({ dispatch }, route) {
// FIXME vue3 currentRoute is now a ref (currentRoute.value)
dispatch('RESET_CONNECTED')
if (router.currentRoute.name === 'login') return
if (router.currentRoute.value.name === 'login') return
const previousRoute = route ?? router.currentRoute.value
router.push({
name: 'login',
// Add a redirect query if next route is not unknown (like `logout`) or `login`
query:
route && !['login', null].includes(route.name)
? { redirect: route.path }
previousRoute && !['login', null].includes(previousRoute.name)
? { redirect: previousRoute.path }
: {},
})
},