Tokens bug resolved, login error handled

This commit is contained in:
Blue 2024-07-07 17:55:25 -03:00
parent cdde0b9e2e
commit 7b2b5f5284
Signed by: blue
GPG Key ID: 9B203B252A63EE38

View File

@ -73,16 +73,16 @@ API::RequestId API::sendLogin (const QString& login, const QString& password, co
log.get(), log.get(),
&Request::Login::success, &Request::Login::success,
this, this,
[this, &finished] (const QVariantMap& data) { [this, finished] (const QVariantMap& data) {
callCallback(finished, QString(), {QJSValue(true)}); callCallback(finished, QString(), {QJSValue(true)});
magpie.setTokens(data.value("accessToken").toString(), data.value("renewToken").toString()); magpie.setTokens(data.value("accessToken").toString(), data.value("renewToken").toString(), true);
} }
); );
connect( connect(
log.get(), log.get(),
&Request::Login::error, &Request::Login::error,
this, this,
[this, &finished] (const QString& error) { [this, finished] (const QString& error) {
callCallback(finished, error, {QJSValue(false)}); callCallback(finished, error, {QJSValue(false)});
magpie.setState(Models::Magpie::NotAuthenticated); magpie.setState(Models::Magpie::NotAuthenticated);
} }