Fixing Issue if server returns not 200 while signing in (#12211)

Signed-off-by: EvilPingu <ckittel@gmx.de>
This commit is contained in:
Christian Kittel 2022-02-05 21:21:51 +01:00 committed by GitHub
parent e872e14894
commit b9a838bf18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,17 +73,19 @@ public class SignInService {
connectionLosed.run();
return;
}
if (result.getResponse().getStatus() != 200) {
unauthorized.run();
if (result.getResponse().getStatus() == 200) {
PostSignInResponseModel signInModel = gson.fromJson(getContentAsString(),
PostSignInResponseModel.class);
if (signInModel == null || signInModel.errorCode != 0 || signInModel.sessionId.equals("")) {
unauthorized.run();
return;
}
signInDone.accept(signInModel.sessionId);
return;
}
PostSignInResponseModel signInModel = gson.fromJson(getContentAsString(),
PostSignInResponseModel.class);
if (signInModel == null || signInModel.errorCode != 0 || signInModel.sessionId.equals("")) {
unauthorized.run();
return;
}
signInDone.accept(signInModel.sessionId);
connectionLosed.run();
return;
}
});
}