=> {
+ const { state, isAuthenticated, signIn } = useAsgardeo()
+
+ // Wait for loading to complete if still in progress
+ if (state.isLoading) {
+ await waitForAsgardeoLoaded(state)
+ }
- isAuthenticated()
- .then((auth: boolean) => {
- if (auth) {
- next()
- } else {
- next('/')
- }
- })
- .catch(() => {
- next('/')
- })
+ try {
+ const auth: boolean = await isAuthenticated()
+ if (!auth) {
+ await signIn()
+ return false // Prevent navigation until sign-in completes
+ }
+ return true
+ } catch {
+ return false // Prevent navigation on error
+ }
},
- component: AboutView,
- name: 'about',
- path: '/about',
+ component: HomeView,
+ name: 'home',
+ path: '/home',
},
],
})
diff --git a/recipes/vue-vite/src/views/AboutView.vue b/recipes/vue-vite/src/shims-vue.d.ts
similarity index 74%
rename from recipes/vue-vite/src/views/AboutView.vue
rename to recipes/vue-vite/src/shims-vue.d.ts
index 092be08a..6fd65757 100644
--- a/recipes/vue-vite/src/views/AboutView.vue
+++ b/recipes/vue-vite/src/shims-vue.d.ts
@@ -1,4 +1,4 @@
-
+ */
-
-
-
This is an about page
-
-
+declare module '*.vue' {
+ import { DefineComponent } from 'vue'
-
diff --git a/recipes/vue-vite/src/views/HomeView.vue b/recipes/vue-vite/src/views/HomeView.vue
index 493c9907..c16764fb 100644
--- a/recipes/vue-vite/src/views/HomeView.vue
+++ b/recipes/vue-vite/src/views/HomeView.vue
@@ -1,7 +1,40 @@
-
-
+
+
Welcome to the Home Page!
+
{{ userEmail }}
+
+
+
diff --git a/recipes/vue-vite/src/views/LandingView.vue b/recipes/vue-vite/src/views/LandingView.vue
new file mode 100644
index 00000000..800dbe2e
--- /dev/null
+++ b/recipes/vue-vite/src/views/LandingView.vue
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+ Asgardeo + Vue
+ Click on the logos to learn more
+
+
+ Go to Home
+
+
+
+