Horrible redirect kludge to fix login flow, tidy up and readme
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
middleware: ['auth'],
|
||||
layout: "authenticated",
|
||||
});
|
||||
definePageMeta({
|
||||
middleware: ['auth'],
|
||||
layout: "authenticated",
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
middleware: ['auth'],
|
||||
});
|
||||
definePageMeta({
|
||||
middleware: ['auth'],
|
||||
});
|
||||
|
||||
//horrible horrible kludge from https://github.com/nuxt-modules/supabase/issues/28#issuecomment-1353070523
|
||||
const user = useSupabaseUser();
|
||||
watchEffect(async () => {
|
||||
if (user.value) await navigateTo("dashboard");
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
async function signInWithGoogle() {
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'google',
|
||||
// options: { redirectTo: 'dashboard'} // the redirectTo option doesn't work
|
||||
})
|
||||
navigateTo('dashboard'); // This doesn't work, it navigates prior to the login handshake completing and then the handshake lands on the index page and ignores the middleware.
|
||||
// navigateTo('dashboard'); // This doesn't work, it navigates prior to the oauth handshake completing and then the handshake lands on the index page and ignores the middleware.
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user