Add auth starter
This commit is contained in:
17
ui/pages/auth/signin.vue
Normal file
17
ui/pages/auth/signin.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- This page will automatically redirect to the default provider -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue';
|
||||
import { useAuth } from '#imports';
|
||||
|
||||
const { signIn } = useAuth();
|
||||
|
||||
// Automatically redirect to the default provider when the page loads
|
||||
onMounted(() => {
|
||||
signIn('default');
|
||||
});
|
||||
</script>
|
||||
21
ui/pages/index.vue
Normal file
21
ui/pages/index.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<button @click="login()">
|
||||
login
|
||||
</button>
|
||||
<p> You are {{ authStatus }}</p>
|
||||
<p v-if="user">Email: {{ user.email }}</p>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
const { signIn, signOut, status, data } = useAuth();
|
||||
const authStatus = status.value;
|
||||
const user = data.value?.user;
|
||||
|
||||
|
||||
function login() {
|
||||
signIn('default');
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user