@@ -3,7 +3,7 @@ import { NativeModules, NativeEventEmitter } from 'react-native';
3
3
4
4
import User from './user' ;
5
5
import { Base } from './base' ;
6
- import { promisify } from '../utils' ;
6
+ import { promisify , toWebSDKErrorCode } from '../utils' ;
7
7
8
8
const FirestackAuth = NativeModules . FirestackAuth ;
9
9
const FirestackAuthEvt = new NativeEventEmitter ( FirestackAuth ) ;
@@ -75,7 +75,7 @@ export default class Auth extends Base {
75
75
*/
76
76
createUserWithEmailAndPassword ( email : string , password : string ) : Promise < Object > {
77
77
this . log . info ( 'Creating user with email and password' , email ) ;
78
- return promisify ( 'createUserWithEmail' , FirestackAuth ) ( email , password ) ;
78
+ return promisify ( 'createUserWithEmail' , FirestackAuth , 'auth/' ) ( email , password ) ;
79
79
}
80
80
81
81
/**
@@ -86,7 +86,7 @@ export default class Auth extends Base {
86
86
*/
87
87
signInWithEmailAndPassword ( email : string , password : string ) : Promise < Object > {
88
88
this . log . info ( 'Signing in user with email and password' , email ) ;
89
- return promisify ( 'signInWithEmail' , FirestackAuth ) ( email , password ) ;
89
+ return promisify ( 'signInWithEmail' , FirestackAuth , 'auth/' ) ( email , password ) ;
90
90
}
91
91
92
92
// TODO move user methods to User class
@@ -97,14 +97,14 @@ export default class Auth extends Base {
97
97
* @return {Promise } A promise resolved upon completion
98
98
*/
99
99
updateEmail ( email : string ) : Promise < Object > {
100
- return promisify ( 'updateUserEmail' , FirestackAuth ) ( email ) ;
100
+ return promisify ( 'updateUserEmail' , FirestackAuth , 'auth/' ) ( email ) ;
101
101
}
102
102
103
103
/**
104
104
* Send verification email to current user.
105
105
*/
106
106
sendEmailVerification ( ) : Promise < Object > {
107
- return promisify ( 'sendEmailVerification' , FirestackAuth ) ( ) ;
107
+ return promisify ( 'sendEmailVerification' , FirestackAuth , 'auth/' ) ( ) ;
108
108
}
109
109
110
110
/**
@@ -113,7 +113,7 @@ export default class Auth extends Base {
113
113
* @return {Promise }
114
114
*/
115
115
updatePassword ( password : string ) : Promise < Object > {
116
- return promisify ( 'updateUserPassword' , FirestackAuth ) ( password ) ;
116
+ return promisify ( 'updateUserPassword' , FirestackAuth , 'auth/' ) ( password ) ;
117
117
}
118
118
119
119
/**
@@ -122,7 +122,7 @@ export default class Auth extends Base {
122
122
* @return {Promise }
123
123
*/
124
124
updateProfile ( updates : Object = { } ) : Promise < Object > {
125
- return promisify ( 'updateUserProfile' , FirestackAuth ) ( updates ) ;
125
+ return promisify ( 'updateUserProfile' , FirestackAuth , 'auth/' ) ( updates ) ;
126
126
}
127
127
128
128
/**
@@ -139,47 +139,47 @@ export default class Auth extends Base {
139
139
* @return {Promise } A promise resolved upon completion
140
140
*/
141
141
signInWithCredential ( credential : CredentialType ) : Promise < Object > {
142
- return promisify ( 'signInWithProvider' , FirestackAuth ) ( credential . provider , credential . token , credential . secret ) ;
142
+ return promisify ( 'signInWithProvider' , FirestackAuth , 'auth/' ) ( credential . provider , credential . token , credential . secret ) ;
143
143
}
144
144
145
145
/**
146
146
* Re-authenticate a user with a third-party authentication provider
147
147
* @return {Promise } A promise resolved upon completion
148
148
*/
149
149
reauthenticateUser ( credential : CredentialType ) : Promise < Object > {
150
- return promisify ( 'reauthenticateWithCredentialForProvider' , FirestackAuth ) ( credential . provider , credential . token , credential . secret ) ;
150
+ return promisify ( 'reauthenticateWithCredentialForProvider' , FirestackAuth , 'auth/' ) ( credential . provider , credential . token , credential . secret ) ;
151
151
}
152
152
153
153
/**
154
154
* Sign a user in anonymously
155
155
* @return {Promise } A promise resolved upon completion
156
156
*/
157
157
signInAnonymously ( ) : Promise < Object > {
158
- return promisify ( 'signInAnonymously' , FirestackAuth ) ( ) ;
158
+ return promisify ( 'signInAnonymously' , FirestackAuth , 'auth/' ) ( ) ;
159
159
}
160
160
161
161
/**
162
162
* Send reset password instructions via email
163
163
* @param {string } email The email to send password reset instructions
164
164
*/
165
165
sendPasswordResetEmail ( email : string ) : Promise < Object > {
166
- return promisify ( 'sendPasswordResetWithEmail' , FirestackAuth ) ( email ) ;
166
+ return promisify ( 'sendPasswordResetWithEmail' , FirestackAuth , 'auth/' ) ( email ) ;
167
167
}
168
168
169
169
/**
170
170
* Delete the current user
171
171
* @return {Promise }
172
172
*/
173
173
deleteUser ( ) : Promise < Object > {
174
- return promisify ( 'deleteUser' , FirestackAuth ) ( ) ;
174
+ return promisify ( 'deleteUser' , FirestackAuth , 'auth/' ) ( ) ;
175
175
}
176
176
177
177
/**
178
178
* get the token of current user
179
179
* @return {Promise }
180
180
*/
181
181
getToken ( ) : Promise < Object > {
182
- return promisify ( 'getToken' , FirestackAuth ) ( ) ;
182
+ return promisify ( 'getToken' , FirestackAuth , 'auth/' ) ( ) ;
183
183
}
184
184
185
185
@@ -188,15 +188,15 @@ export default class Auth extends Base {
188
188
* @return {Promise }
189
189
*/
190
190
signOut ( ) : Promise < Object > {
191
- return promisify ( 'signOut' , FirestackAuth ) ( ) ;
191
+ return promisify ( 'signOut' , FirestackAuth , 'auth/' ) ( ) ;
192
192
}
193
193
194
194
/**
195
195
* Get the currently signed in user
196
196
* @return {Promise }
197
197
*/
198
198
getCurrentUser ( ) : Promise < Object > {
199
- return promisify ( 'getCurrentUser' , FirestackAuth ) ( ) ;
199
+ return promisify ( 'getCurrentUser' , FirestackAuth , 'auth/' ) ( ) ;
200
200
}
201
201
202
202
/**
0 commit comments