Retrieving the JSON data of the current index to send to the server through the proxy model. Sending this data happens by triggering the core.
This commit is contained in:
@ -60,20 +60,7 @@ void ServerCommunicator::fetchItems() {
|
||||
});
|
||||
}
|
||||
|
||||
void ServerCommunicator::postItems() {
|
||||
QJsonObject itemObject;
|
||||
itemObject["name"] = "Post test 1";
|
||||
itemObject["description"] = "Post description 1";
|
||||
itemObject["info"] = "Post info 1";
|
||||
itemObject["amount"] = 1;
|
||||
itemObject["factor"] = 5.3;
|
||||
|
||||
QJsonObject rootObject;
|
||||
rootObject.insert("item", itemObject);
|
||||
|
||||
QJsonDocument jsonDoc(rootObject);
|
||||
QByteArray jsonData = jsonDoc.toJson();
|
||||
|
||||
void ServerCommunicator::postItems(const QByteArray& jsonData) {
|
||||
QNetworkReply* reply = m_restManager->post(m_serviceApi->createRequest(ROUTE_ITEMS), jsonData);
|
||||
|
||||
QObject::connect(reply, &QNetworkReply::finished, [=]() {
|
||||
|
||||
Reference in New Issue
Block a user