@@ -41,10 +41,10 @@ function getProviders() {
4141function simpleLink ( credential ) {
4242 // [START auth_simple_link]
4343 auth . currentUser . linkWithCredential ( credential )
44- . then ( function ( usercred ) {
44+ . then ( ( usercred ) => {
4545 var user = usercred . user ;
4646 console . log ( "Account linking success" , user ) ;
47- } ) . catch ( function ( error ) {
47+ } ) . catch ( ( error ) => {
4848 console . log ( "Account linking error" , error ) ;
4949 } ) ;
5050 // [END auth_simple_link]
@@ -53,10 +53,10 @@ function simpleLink(credential) {
5353function anonymousLink ( credential ) {
5454 // [START auth_anonymous_link]
5555 auth . currentUser . linkWithCredential ( credential )
56- . then ( function ( usercred ) {
56+ . then ( ( usercred ) => {
5757 var user = usercred . user ;
5858 console . log ( "Anonymous account successfully upgraded" , user ) ;
59- } ) . catch ( function ( error ) {
59+ } ) . catch ( ( error ) => {
6060 console . log ( "Error upgrading anonymous account" , error ) ;
6161 } ) ;
6262 // [END auth_anonymous_link]
@@ -66,12 +66,12 @@ function linkWithPopup() {
6666 var provider = new firebase . auth . GoogleAuthProvider ( ) ;
6767
6868 // [START auth_link_with_popup]
69- auth . currentUser . linkWithPopup ( provider ) . then ( function ( result ) {
69+ auth . currentUser . linkWithPopup ( provider ) . then ( ( result ) => {
7070 // Accounts successfully linked.
7171 var credential = result . credential ;
7272 var user = result . user ;
7373 // ...
74- } ) . catch ( function ( error ) {
74+ } ) . catch ( ( error ) => {
7575 // Handle Errors here.
7676 // ...
7777 } ) ;
@@ -88,14 +88,14 @@ function linkWithRedirect() {
8888 // [END auth_link_with_redirect]
8989
9090 // [START auth_get_redirect_result]
91- auth . getRedirectResult ( ) . then ( function ( result ) {
91+ auth . getRedirectResult ( ) . then ( ( result ) => {
9292 if ( result . credential ) {
9393 // Accounts successfully linked.
9494 var credential = result . credential ;
9595 var user = result . user ;
9696 // ...
9797 }
98- } ) . catch ( function ( error ) {
98+ } ) . catch ( ( error ) => {
9999 // Handle Errors here.
100100 // ...
101101 } ) ;
@@ -118,7 +118,7 @@ function mergeAccounts(newCredential) {
118118 repo . delete ( prevUser ) ;
119119
120120 // Sign in user with the account you want to link to
121- auth . signInWithCredential ( newCredential ) . then ( function ( result ) {
121+ auth . signInWithCredential ( newCredential ) . then ( ( result ) => {
122122 console . log ( "Sign In Success" , result ) ;
123123 var currentUser = result . user ;
124124 var currentUserData = repo . get ( currentUser ) ;
@@ -128,15 +128,15 @@ function mergeAccounts(newCredential) {
128128 var mergedData = repo . merge ( prevUserData , currentUserData ) ;
129129
130130 return prevUser . linkWithCredential ( result . credential )
131- . then ( function ( linkResult ) {
131+ . then ( ( linkResult ) => {
132132 // Sign in with the newly linked credential
133133 return auth . signInWithCredential ( linkResult . credential ) ;
134134 } )
135- . then ( function ( signInResult ) {
135+ . then ( ( signInResult ) => {
136136 // Save the merged data to the new user
137137 repo . set ( signInResult . user , mergedData ) ;
138138 } ) ;
139- } ) . catch ( function ( error ) {
139+ } ) . catch ( ( error ) => {
140140 // If there are errors we want to undo the data merge/deletion
141141 console . log ( "Sign In Error" , error ) ;
142142 repo . set ( prevUser , prevUserData ) ;
@@ -157,10 +157,10 @@ function unlink(providerId) {
157157 var user = auth . currentUser ;
158158
159159 // [START auth_unlink_provider]
160- user . unlink ( providerId ) . then ( function ( ) {
160+ user . unlink ( providerId ) . then ( ( ) => {
161161 // Auth provider unlinked from account
162162 // ...
163- } ) . catch ( function ( error ) {
163+ } ) . catch ( ( error ) => {
164164 // An error happened
165165 // ...
166166 } ) ;
0 commit comments