initial commit
This commit is contained in:
30
layouts/authenticated.vue
Normal file
30
layouts/authenticated.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
const supabase = useSupabaseAuthClient();
|
||||
const user = await useSupabaseUser();
|
||||
const email = (user.value)?user.value.email:null;
|
||||
|
||||
async function signout() {
|
||||
const { error } = await supabase.auth.signOut()
|
||||
navigateTo('/');
|
||||
}
|
||||
|
||||
// onMounted(() => {
|
||||
// watchEffect(() => {
|
||||
// if(user.value) {
|
||||
// console.log('user now has a value');
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h3>Authenticated Header</h3>
|
||||
<div v-if="email">logged in as: {{ email }}: <button @click="signout()">Sign Out</button></div>
|
||||
<div v-if="!email">Not Logged in</div>
|
||||
<hr>
|
||||
<slot />
|
||||
<hr>
|
||||
<h4>Authenticated Footer</h4>
|
||||
</div>
|
||||
</template>
|
||||
9
layouts/default.vue
Normal file
9
layouts/default.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div>
|
||||
<h3>Default Header</h3>
|
||||
<hr>
|
||||
<slot />
|
||||
<hr>
|
||||
<h4>Default Footer</h4>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user