File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <NuxtWelcome />
3
+ <Login />
4
4
</div >
5
5
</template >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <h2 >Login</h2 >
4
+ <span v-if =" currentUser" > Welcome {{ currentUser.displayName }}</span >
5
+ <span v-else > <div id =" firebaseui-auth-container" ></div ></span >
6
+ </div >
7
+ </template >
8
+
9
+ <script lang="ts" setup>
10
+
11
+ import { EmailAuthProvider , GoogleAuthProvider } from ' firebase/auth' ;
12
+ import * as firebaseui from ' firebaseui'
13
+ import ' firebaseui/dist/firebaseui.css'
14
+ import { useCurrentUser } from ' vuefire' ;
15
+
16
+ const currentUser = useCurrentUser ()
17
+ const ui = firebaseui .auth .AuthUI .getInstance () || new firebaseui .auth .AuthUI (useFirebaseAuth ());
18
+ const config = {
19
+ signInOptions: [
20
+ GoogleAuthProvider .PROVIDER_ID ,
21
+ EmailAuthProvider .PROVIDER_ID ,
22
+ ],
23
+ signInSuccessUrl: " /" ,
24
+ callbacks: {
25
+ signInSuccessWithAuthResult() {
26
+ console .log (" Successfully signed in" );
27
+ // window.location = "/";
28
+ },
29
+ },
30
+ }
31
+
32
+ onMounted (() => {
33
+ ui .start (" #firebaseui-auth-container" , config );
34
+ })
35
+
36
+ </script >
You can’t perform that action at this time.
0 commit comments