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
+3 -4
View File
@@ -1,9 +1,8 @@
import { useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import { authApi } from '@/api/auth'
import { redirectToSSO } from '@/utils/sso'
export function useAuth() {
const router = useRouter()
const authStore = useAuthStore()
const login = async (username: string, password: string) => {
@@ -16,12 +15,12 @@ export function useAuth() {
const logout = async () => {
await authApi.logout()
authStore.clearAuth()
router.push('/login')
redirectToSSO()
}
const checkAuth = () => {
if (!authStore.isLoggedIn()) {
router.push('/login')
redirectToSSO()
return false
}
return true