fix(auth): OAuth login dialog logging state.

This commit is contained in:
huanghongxun 2021-10-12 22:53:35 +08:00
parent b5484bb13b
commit ec3dfb908c

View File

@ -67,14 +67,17 @@ public class OAuthAccountLoginDialog extends DialogPane {
@Override
protected void onAccept() {
setLoading();
logging.set(true);
Task.supplyAsync(account::logInWhenCredentialsExpired)
.whenComplete(Schedulers.javafx(), authInfo -> {
success.accept(authInfo);
onSuccess();
}, e -> {
LOG.log(Level.INFO, "Failed to login when credentials expired: " + account, e);
onFailure(Accounts.localizeErrorMessage(e));
.whenComplete(Schedulers.javafx(), (authInfo, exception) -> {
logging.set(false);
if (exception == null) {
success.accept(authInfo);
onSuccess();
} else {
LOG.log(Level.INFO, "Failed to login when credentials expired: " + account, exception);
onFailure(Accounts.localizeErrorMessage(exception));
}
}).start();
}