Skip to content

Commit e01726d

Browse files
committed
try to use one handler for login and sign up
1 parent b6221f3 commit e01726d

1 file changed

Lines changed: 1 addition & 23 deletions

File tree

src/api/auth.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,6 @@ export default class Auth {
2828
}
2929

3030
_processJWT(promise, jwt) {
31-
return promise.then(response => {
32-
jwt = response.headers.get('jwt');
33-
34-
if (response.status == 200 && jwt) {
35-
return response.json();
36-
}
37-
38-
throw new Error('Server error, try again later. Sorry for inconvenience :(');
39-
})
40-
.then(user => {
41-
if (user.email) {
42-
return {
43-
user,
44-
jwt,
45-
};
46-
}
47-
48-
throw new Error('Server error, try again later. Sorry for inconvenience :(');
49-
});
50-
}
51-
52-
_processJWTinSignup(promise, jwt) {
5331
return promise.then(response => {
5432
jwt = response.headers.get('jwt');
5533
return response.json();
@@ -86,7 +64,7 @@ export default class Auth {
8664
}
8765
);
8866

89-
return this._processJWTinSignup(signupPromise, jwt);
67+
return this._processJWT(signupPromise, jwt);
9068
}
9169

9270
// @method login(email: String, password: String, org: String): Promise<LoginResponse>

0 commit comments

Comments
 (0)