update BF login sso outsite login
This commit is contained in:
@@ -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,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)
|
||||
|
||||
Reference in New Issue
Block a user