File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,23 @@ function authStateListener() {
63
63
// [END auth_state_listener]
64
64
}
65
65
66
+ function currentUser ( ) {
67
+ // [START auth_current_user]
68
+ const { getAuth } = require ( "firebase/auth" ) ;
69
+
70
+ const auth = getAuth ( ) ;
71
+ const user = auth . currentUser ;
72
+
73
+ if ( user ) {
74
+ // User is signed in, see docs for a list of available properties
75
+ // https://firebase.google.com/docs/reference/js/firebase.User
76
+ // ...
77
+ } else {
78
+ // No user is signed in.
79
+ }
80
+ // [END auth_current_user]
81
+ }
82
+
66
83
function setLanguageCode ( ) {
67
84
// [START auth_set_language_code]
68
85
const { getAuth } = require ( "firebase/auth" ) ;
Original file line number Diff line number Diff line change @@ -54,6 +54,20 @@ function authStateListener() {
54
54
// [END auth_state_listener]
55
55
}
56
56
57
+ function currentUser ( ) {
58
+ // [START auth_current_user]
59
+ const user = firebase . auth ( ) . currentUser ;
60
+
61
+ if ( user ) {
62
+ // User is signed in, see docs for a list of available properties
63
+ // https://firebase.google.com/docs/reference/js/firebase.User
64
+ // ...
65
+ } else {
66
+ // No user is signed in.
67
+ }
68
+ // [END auth_current_user]
69
+ }
70
+
57
71
function setLanguageCode ( ) {
58
72
// [START auth_set_language_code]
59
73
firebase . auth ( ) . languageCode = 'it' ;
Original file line number Diff line number Diff line change
1
+ // This snippet file was generated by processing the source file:
2
+ // ./auth-next/index.js
3
+ //
4
+ // To make edits to the snippets in this file, please edit the source
5
+
6
+ // [START auth_current_user_modular]
7
+ import { getAuth } from "firebase/auth" ;
8
+
9
+ const auth = getAuth ( ) ;
10
+ const user = auth . currentUser ;
11
+
12
+ if ( user ) {
13
+ // User is signed in, see docs for a list of available properties
14
+ // https://firebase.google.com/docs/reference/js/firebase.User
15
+ // ...
16
+ } else {
17
+ // No user is signed in.
18
+ }
19
+ // [END auth_current_user_modular]
You can’t perform that action at this time.
0 commit comments