File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,27 @@ export default class Auth {
4646 } ) ;
4747 }
4848
49+ _processJWTinSignup ( promise , jwt ) {
50+ return promise . then ( response => {
51+ jwt = response . headers . get ( 'jwt' ) ;
52+ return response . json ( ) ;
53+ } )
54+ . then ( data => {
55+ if ( data . email ) {
56+ return {
57+ user,
58+ jwt,
59+ } ;
60+ }
61+
62+ if ( data . errors ) {
63+ throw data . errors ;
64+ }
65+
66+ throw new Error ( 'Server error, try again later. Sorry for inconvenience :(' ) ;
67+ } ) ;
68+ }
69+
4970 // @method signup(email: String, name: String, password: String): Promise
5071 // Register new user
5172 signup ( email , name , password ) {
@@ -60,7 +81,7 @@ export default class Auth {
6081 }
6182 ) ;
6283
63- return this . _processJWT ( signupPromise , jwt ) ;
84+ return this . _processJWTinSignup ( signupPromise , jwt ) ;
6485 }
6586
6687 // @method login(email: String, password: String, org: String): Promise<LoginResponse>
You can’t perform that action at this time.
0 commit comments