From 8674b5874ad3c6dce620f1aee9e45a393247c007 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 5 May 2022 16:08:32 +0800 Subject: [PATCH] fix: routing loop entry after reinstallation Signed-off-by: Ryan Wang --- src/router/guard/permissionGuard.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/router/guard/permissionGuard.js b/src/router/guard/permissionGuard.js index 73db79331..a99f5db73 100644 --- a/src/router/guard/permissionGuard.js +++ b/src/router/guard/permissionGuard.js @@ -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'