Solve the problem of returning to the login interface and constantly loading after authentication timeout

This commit is contained in:
liufu 2023-04-17 17:29:08 +08:00
parent de317d8e6d
commit dc19d1dc01
2 changed files with 8 additions and 7 deletions

View file

@ -52,6 +52,8 @@ function rediretToLogin() {
store.commit('system/clearOpenedMenu')
store.commit('system/setCurrentRouterPath', '')
clearLoading() // Clear all loads
router.push('/login')
}
@ -69,6 +71,11 @@ const closeLoading = () => {
}
}
const clearLoading = () => {
acitveAxios = 0
emitter.emit('closeLoading')
}
const handleRefreshToken = (token: string) => {
const refreshToken = store.getters['user/refreshToken']
store.commit('user/setIsRefreshingToken', true)

View file

@ -19,22 +19,16 @@
</template>
<script lang="ts" setup>
import { reactive, onMounted } from 'vue'
import { reactive } from 'vue'
import LoginForm from '@/components/login/login-form.vue'
import LanguagesSwitch from '@/components/system/languages.vue'
import Logo from '@/components/system/logo.vue'
import { emitter } from '@/utils/bus.js'
const method = reactive({
toICP: () => {
window.open('https://beian.miit.gov.cn/', '_blank')
}
})
//
onMounted(() => {
emitter.emit('closeLoading')
})
</script>
<style scoped lang="less">