upgrade supabase auth to recommended

This commit is contained in:
Michael Dausmann
2023-11-06 20:09:08 +11:00
parent 6e5c8547ea
commit 7e46acf449
9 changed files with 351 additions and 197 deletions

15
pages/confirm.vue Normal file
View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
const user = useSupabaseUser();
watch(
user,
() => {
if (user.value) {
return navigateTo('/dashboard');
}
},
{ immediate: true }
);
</script>
<template>
<div>Logging you in...</div>
</template>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
const supabase = useSupabaseAuthClient();
const supabase = useSupabaseClient();
const config = useRuntimeConfig();
const notifyStore = useNotifyStore();

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
const supabase = useSupabaseAuthClient();
const supabase = useSupabaseClient();
const notifyStore = useNotifyStore();

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
const user = useSupabaseUser();
const supabase = useSupabaseAuthClient();
const supabase = useSupabaseClient();
const accountStore = useAccountStore();
const notifyStore = useNotifyStore();
@@ -8,6 +8,7 @@
const loading = ref(false);
const email = ref('');
const password = ref('');
const config = useRuntimeConfig();
const handleStandardSignin = async () => {
console.log(
@@ -32,7 +33,10 @@
try {
loading.value = true;
const { error } = await supabase.auth.signInWithOAuth({
provider: 'google'
provider: 'google',
options: {
redirectTo: `${config.public.siteRootUrl}/confirm`
}
});
if (error) throw error;
} catch (error) {

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
const user = useSupabaseUser();
const supabase = useSupabaseAuthClient();
const supabase = useSupabaseClient();
const notifyStore = useNotifyStore();