Minor refactoring for API authentication.
This commit is contained in:
@ -39,7 +39,7 @@ GenericCore::GenericCore() {
|
||||
m_modelUndoStack = new QUndoStack(this);
|
||||
|
||||
setupModels();
|
||||
setupServerConfiguration();
|
||||
setupServerCommunication();
|
||||
}
|
||||
|
||||
GenericCore::~GenericCore() { qDebug() << "Destroying core..."; }
|
||||
@ -129,7 +129,7 @@ void GenericCore::applySettings(QVariantMap settingMap, QString group) {
|
||||
SettingsHandler::saveSettings(settingMap, group);
|
||||
|
||||
if (group == "Server") {
|
||||
setupServerConfiguration();
|
||||
applyServerConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,6 +157,7 @@ void GenericCore::saveItems() {
|
||||
emit displayStatusMessage(QString("Error: Items couldn't be saved."));
|
||||
}
|
||||
}
|
||||
|
||||
void GenericCore::onSendItemTriggered(const QByteArray& jsonData) {
|
||||
m_serverCommunicator->postItems(jsonData);
|
||||
}
|
||||
@ -246,7 +247,7 @@ QString GenericCore::getMaintenanceToolFilePath() const {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
void GenericCore::setupServerConfiguration() {
|
||||
void GenericCore::setupServerCommunication() {
|
||||
m_serverCommunicator = make_unique<ServerCommunicator>(this);
|
||||
/// request connections
|
||||
connect(this, &GenericCore::fetchItemsFromServer, m_serverCommunicator.get(),
|
||||
@ -275,6 +276,7 @@ void GenericCore::setupServerConfiguration() {
|
||||
void GenericCore::applyServerConfiguration() {
|
||||
const QVariantMap serverSettings = SettingsHandler::getSettings("Server");
|
||||
const QString urlValue = serverSettings.value("url").toString();
|
||||
// NEXT if urlValue is empty -> remove authToken from settings?
|
||||
if (!urlValue.isEmpty()) {
|
||||
const QString emailValue = serverSettings.value("email").toString();
|
||||
const QString passwordValue = serverSettings.value("password").toString();
|
||||
|
||||
Reference in New Issue
Block a user