From d5f1f6ce6d5d2a973ff95686a081207496800c52 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 5 May 2022 17:08:12 +0800 Subject: [PATCH] fix: routing loop entry after reinstallation (#558) 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 73db7933..a99f5db7 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'