Redirect to profile after signin

This commit is contained in:
Alexis
2024-08-25 14:37:32 +02:00
parent 6c73578b7f
commit 05ae4bfb1f
4 changed files with 9 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ const router = useRouter()
const { auth } = useSupabaseClient()
const user = useSupabaseUser()
const userMeta = computed(() => user.value?.user_metadata)
const profileUrl: string = `${useRequestURL().origin}/i/`
const menuOpened = ref<boolean>(false)
@@ -24,7 +25,8 @@ async function handleGoogleLogin() {
queryParams: {
access_type: "offline",
prompt: "consent"
}
},
redirectTo: profileUrl
}
})
} catch (err) {

View File

@@ -14,7 +14,10 @@ export default defineNuxtConfig({
css: ["~/assets/main.css"],
supabase: {
redirect: false
redirectOptions: {
login: "/",
callback: "/i"
}
},
postcss: {

View File

@@ -12,7 +12,7 @@ definePageMeta({
const user = useSupabaseUser()
// Redirect user back home when they log out on the page
watch(user, (n, _o) => {
watch(user, (n) => {
if (!n) {
navigateTo("/")
}

View File

@@ -22,7 +22,7 @@ definePageMeta({
const user = useSupabaseUser()
// Redirect user back home when they log out on the page
watch(user, (n, _o) => {
watch(user, (n) => {
if (!n) {
navigateTo("/")
}