refactor(frontend): merge authserver web login

This commit is contained in:
mac
2026-07-15 14:47:42 +08:00
parent 6af511ed0b
commit 81d2a8a60b
23 changed files with 178 additions and 1115 deletions
+23 -1
View File
@@ -3,7 +3,29 @@
</template>
<script setup lang="ts">
// 根组件
import { onMounted } from 'vue'
import { authApi } from '@/api/auth'
import { getToken, removeToken } from '@/utils/auth'
import { redirectToSSO } from '@/utils/sso'
import { useAuthStore } from '@/stores/auth'
const authStore = useAuthStore()
onMounted(async () => {
const token = getToken()
if (!token) {
return
}
try {
const { data } = await authApi.getUserInfo()
authStore.setAuth(token, data)
} catch {
authStore.clearAuth()
removeToken()
redirectToSSO()
}
})
</script>
<style>