This commit is contained in:
ari
2025-11-21 15:19:22 +07:00
parent f40d25042b
commit 674a4be4ce
4 changed files with 15 additions and 8 deletions
+2 -3
View File
@@ -3,7 +3,6 @@ import type { z } from 'zod'
import { toTypedSchema } from '@vee-validate/zod'
import { Loader2 } from 'lucide-vue-next'
import { useForm } from 'vee-validate'
import { useRouter } from 'vue-router'
import { useKeycloak } from "~/composables/useKeycloack"
interface Props {
@@ -37,7 +36,7 @@ const onSubmit = handleSubmit(async (values) => {
}
})
const { initKeycloak, getProfile, login } = useKeycloak()
const { initKeycloak, getProfile, loginSSO } = useKeycloak()
const profile = ref<any>(null)
onMounted(async () => {
@@ -49,7 +48,7 @@ onMounted(async () => {
const onSSO = (async () => {
try {
const redirect = window.location.origin + '/auth/sso'
await login({ redirectUri: redirect })
await loginSSO({ redirectUri: redirect })
} catch (error) {
console.error('Call SSO failed:', error)
}
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { useSidebar } from '~/components/pub/ui/sidebar'
import { useKeycloak } from "~/composables/useKeycloack"
// defineProps<{
// user: {
@@ -11,11 +12,15 @@ import { useSidebar } from '~/components/pub/ui/sidebar'
const { isMobile } = useSidebar()
const { user, logout, setActiveRole, getActiveRole } = useUserStore()
const { initKeycloak, logoutSSO } = useKeycloak()
// const userStore = useUserStore().user
function handleLogout() {
initKeycloak('check-sso')
navigateTo('/auth/login')
logout()
logoutSSO(window.location.origin + '/auth/login')
}
const showModalTheme = ref(false)