API authentication token is read from settings and set as bearer token.
This commit is contained in:
@ -36,6 +36,21 @@ void ServerCommunicator::setUrl(const QUrl& url) {
|
||||
emit urlChanged();
|
||||
}
|
||||
|
||||
void ServerCommunicator::setServerConfiguration(const QString url,
|
||||
const QString email,
|
||||
const QString password,
|
||||
const QString authToken) {
|
||||
setUrl(url);
|
||||
|
||||
m_email = email;
|
||||
m_password = password;
|
||||
m_authToken = authToken;
|
||||
|
||||
if (!authToken.isEmpty()) {
|
||||
m_serviceApi->setBearerToken(authToken.toLatin1());
|
||||
}
|
||||
}
|
||||
|
||||
void ServerCommunicator::fetchItems() {
|
||||
/// Set up a GET request
|
||||
m_restManager->get(m_serviceApi->createRequest(ROUTE_ITEMS), this, [this](QRestReply& reply) {
|
||||
@ -94,13 +109,4 @@ void ServerCommunicator::deleteItem(const QString& id) {
|
||||
}
|
||||
reply->deleteLater();
|
||||
});
|
||||
}
|
||||
|
||||
void ServerCommunicator::setServerConfiguration(const QString url,
|
||||
const QString email,
|
||||
const QString password) {
|
||||
setUrl(url);
|
||||
|
||||
m_email = email;
|
||||
m_password = password;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user