update BF
This commit is contained in:
@@ -6,7 +6,7 @@ export default defineNuxtRouteMiddleware(async (to) => {
|
|||||||
|
|
||||||
const { $pinia } = useNuxtApp()
|
const { $pinia } = useNuxtApp()
|
||||||
|
|
||||||
const { initKeycloak, isAuthenticated} = useKeycloak(); // global composable
|
const { initKeycloak, isAuthenticated, getResponse} = useKeycloak(); // global composable
|
||||||
await initKeycloak("check-sso");
|
await initKeycloak("check-sso");
|
||||||
|
|
||||||
if (import.meta.client) {
|
if (import.meta.client) {
|
||||||
@@ -14,7 +14,9 @@ export default defineNuxtRouteMiddleware(async (to) => {
|
|||||||
if (!userStore.isAuthenticated && !isAuthenticated.value) {
|
if (!userStore.isAuthenticated && !isAuthenticated.value) {
|
||||||
return navigateTo('/auth/login')
|
return navigateTo('/auth/login')
|
||||||
} else {
|
} else {
|
||||||
console.log("its logged in!!! ")
|
if (isAuthenticated.value) {
|
||||||
|
await getResponse()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import { ref, onMounted } from 'vue'
|
|||||||
import { useKeycloak } from "~/composables/useKeycloack"
|
import { useKeycloak } from "~/composables/useKeycloack"
|
||||||
|
|
||||||
const error = ref<string | null>(null)
|
const error = ref<string | null>(null)
|
||||||
const { initKeycloak, isAuthenticated, getResponse, loginSSO } = useKeycloak()
|
const { initKeycloak, isAuthenticated, getResponse } = useKeycloak()
|
||||||
const profile = ref<any>(null)
|
|
||||||
const token = ref<string | null>(null);
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
@@ -15,7 +13,7 @@ onMounted(async () => {
|
|||||||
if (isAuthenticated.value) {
|
if (isAuthenticated.value) {
|
||||||
await getResponse()
|
await getResponse()
|
||||||
} else {
|
} else {
|
||||||
await loginSSO({ redirectUri: '/auth/sso' })
|
return navigateTo('/auth/login')
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
error.value = err?.message || String(err)
|
error.value = err?.message || String(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user