fix: routing loop entry after reinstallation (#559)

Signed-off-by: Ryan Wang <i@ryanc.cc>

Co-authored-by: Ryan Wang <i@ryanc.cc>
pull/563/head
Halo Dev Bot 2022-05-05 17:10:12 +08:00 committed by GitHub
parent 1d9ba73d34
commit 11044a88ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,13 @@ router.beforeEach(async (to, from, next) => {
await store.dispatch('fetchIsInstalled')
}
// if it is not installed, empty the dirty data
if (!store.getters.isInstalled) {
await store.commit('SET_OPTIONS', undefined)
await store.commit('CLEAR_TOKEN')
await store.commit('SET_USER', {})
}
if (!store.getters.isInstalled && to.name !== 'Install') {
next({
name: 'Install'