-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed and simplified login flow by adding route guards
- Loading branch information
Showing
6 changed files
with
66 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
<template> | ||
<TransitionSlot> | ||
<HomePitch v-if="!currentTopic" /> | ||
<HomePitch v-if="!currentTopic && !isLoading" /> | ||
</TransitionSlot> | ||
<HomeForm /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, watchEffect } from 'vue'; | ||
import { storeToRefs } from 'pinia' | ||
import { useMainStore } from '@/store'; | ||
import router from '@/router'; | ||
import { useAuth0 } from '@auth0/auth0-vue'; | ||
import { PageNames } from '@/router'; | ||
import TransitionSlot from "@/components/TransitionSlot.vue"; | ||
import TransitionSlot from "@/components/TransitionSlot.vue"; | ||
import HomeForm from '@/components/HomeForm.vue'; | ||
import HomePitch from '@/components/HomePitch.vue'; | ||
const store = useMainStore(); | ||
const { currentTopic } = storeToRefs(store); | ||
const { isAuthenticated, isLoading } = useAuth0(); | ||
/// redirect to subscription page if the user is authenticated | ||
watchEffect(() => { | ||
console.log(`HomeView: Auth status: ${isLoading.value}/${isAuthenticated.value}`); | ||
if (isAuthenticated.value) { | ||
console.log("User is authenticated - redirecting to subscription page"); | ||
router.push({ name: PageNames.SUBSCRIPTION }); | ||
} | ||
}); | ||
</script> |