@@ -3,7 +3,7 @@ import { NativeModules, NativeEventEmitter } from 'react-native';
33
44import User from './user' ;
55import { Base } from './base' ;
6- import { promisify } from '../utils' ;
6+ import { promisify , toWebSDKErrorCode } from '../utils' ;
77
88const FirestackAuth = NativeModules . FirestackAuth ;
99const FirestackAuthEvt = new NativeEventEmitter ( FirestackAuth ) ;
@@ -75,7 +75,7 @@ export default class Auth extends Base {
7575 */
7676 createUserWithEmailAndPassword ( email : string , password : string ) : Promise < Object > {
7777 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 ) ;
7979 }
8080
8181 /**
@@ -86,7 +86,7 @@ export default class Auth extends Base {
8686 */
8787 signInWithEmailAndPassword ( email : string , password : string ) : Promise < Object > {
8888 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 ) ;
9090 }
9191
9292 // TODO move user methods to User class
@@ -97,14 +97,14 @@ export default class Auth extends Base {
9797 * @return {Promise } A promise resolved upon completion
9898 */
9999 updateEmail ( email : string ) : Promise < Object > {
100- return promisify ( 'updateUserEmail' , FirestackAuth ) ( email ) ;
100+ return promisify ( 'updateUserEmail' , FirestackAuth , 'auth/' ) ( email ) ;
101101 }
102102
103103 /**
104104 * Send verification email to current user.
105105 */
106106 sendEmailVerification ( ) : Promise < Object > {
107- return promisify ( 'sendEmailVerification' , FirestackAuth ) ( ) ;
107+ return promisify ( 'sendEmailVerification' , FirestackAuth , 'auth/' ) ( ) ;
108108 }
109109
110110 /**
@@ -113,7 +113,7 @@ export default class Auth extends Base {
113113 * @return {Promise }
114114 */
115115 updatePassword ( password : string ) : Promise < Object > {
116- return promisify ( 'updateUserPassword' , FirestackAuth ) ( password ) ;
116+ return promisify ( 'updateUserPassword' , FirestackAuth , 'auth/' ) ( password ) ;
117117 }
118118
119119 /**
@@ -122,7 +122,7 @@ export default class Auth extends Base {
122122 * @return {Promise }
123123 */
124124 updateProfile ( updates : Object = { } ) : Promise < Object > {
125- return promisify ( 'updateUserProfile' , FirestackAuth ) ( updates ) ;
125+ return promisify ( 'updateUserProfile' , FirestackAuth , 'auth/' ) ( updates ) ;
126126 }
127127
128128 /**
@@ -139,47 +139,47 @@ export default class Auth extends Base {
139139 * @return {Promise } A promise resolved upon completion
140140 */
141141 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 ) ;
143143 }
144144
145145 /**
146146 * Re-authenticate a user with a third-party authentication provider
147147 * @return {Promise } A promise resolved upon completion
148148 */
149149 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 ) ;
151151 }
152152
153153 /**
154154 * Sign a user in anonymously
155155 * @return {Promise } A promise resolved upon completion
156156 */
157157 signInAnonymously ( ) : Promise < Object > {
158- return promisify ( 'signInAnonymously' , FirestackAuth ) ( ) ;
158+ return promisify ( 'signInAnonymously' , FirestackAuth , 'auth/' ) ( ) ;
159159 }
160160
161161 /**
162162 * Send reset password instructions via email
163163 * @param {string } email The email to send password reset instructions
164164 */
165165 sendPasswordResetEmail ( email : string ) : Promise < Object > {
166- return promisify ( 'sendPasswordResetWithEmail' , FirestackAuth ) ( email ) ;
166+ return promisify ( 'sendPasswordResetWithEmail' , FirestackAuth , 'auth/' ) ( email ) ;
167167 }
168168
169169 /**
170170 * Delete the current user
171171 * @return {Promise }
172172 */
173173 deleteUser ( ) : Promise < Object > {
174- return promisify ( 'deleteUser' , FirestackAuth ) ( ) ;
174+ return promisify ( 'deleteUser' , FirestackAuth , 'auth/' ) ( ) ;
175175 }
176176
177177 /**
178178 * get the token of current user
179179 * @return {Promise }
180180 */
181181 getToken ( ) : Promise < Object > {
182- return promisify ( 'getToken' , FirestackAuth ) ( ) ;
182+ return promisify ( 'getToken' , FirestackAuth , 'auth/' ) ( ) ;
183183 }
184184
185185
@@ -188,15 +188,15 @@ export default class Auth extends Base {
188188 * @return {Promise }
189189 */
190190 signOut ( ) : Promise < Object > {
191- return promisify ( 'signOut' , FirestackAuth ) ( ) ;
191+ return promisify ( 'signOut' , FirestackAuth , 'auth/' ) ( ) ;
192192 }
193193
194194 /**
195195 * Get the currently signed in user
196196 * @return {Promise }
197197 */
198198 getCurrentUser ( ) : Promise < Object > {
199- return promisify ( 'getCurrentUser' , FirestackAuth ) ( ) ;
199+ return promisify ( 'getCurrentUser' , FirestackAuth , 'auth/' ) ( ) ;
200200 }
201201
202202 /**
0 commit comments