update BF login sso outsite login

This commit is contained in:
ari
2025-11-25 10:27:13 +07:00
parent 5d54157391
commit 6ee33d2525
2 changed files with 3 additions and 3 deletions
-2
View File
@@ -1,7 +1,5 @@
<script setup lang="ts">
import { z } from 'zod'
import Keycloak from 'keycloak-js'
// import { useKeycloak } from '@/stores/keycloak'
const loginSchema = z.object({
name: z.string().min(3, 'Please enter a valid username'),
+3 -1
View File
@@ -3,7 +3,7 @@ import { ref, onMounted } from 'vue'
import { useKeycloak } from "~/composables/useKeycloack"
const error = ref<string | null>(null)
const { initKeycloak, isAuthenticated, getResponse } = useKeycloak()
const { initKeycloak, isAuthenticated, getResponse, loginSSO } = useKeycloak()
const profile = ref<any>(null)
const token = ref<string | null>(null);
@@ -14,6 +14,8 @@ onMounted(async () => {
// small delay to allow token propagation
if (isAuthenticated.value) {
await getResponse()
} else {
await loginSSO({ redirectUri: '/auth/sso' })
}
} catch (err: any) {
error.value = err?.message || String(err)