removed extra if
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
4036cecfc0
commit
8c607ae734
@ -137,26 +137,22 @@ void ResourceModel::search()
|
|||||||
if (!projectId.isEmpty()) {
|
if (!projectId.isEmpty()) {
|
||||||
ResourceAPI::ProjectInfoCallbacks callbacks;
|
ResourceAPI::ProjectInfoCallbacks callbacks;
|
||||||
|
|
||||||
// Use defaults if no callbacks are set
|
callbacks.on_fail = [this](QString reason) {
|
||||||
if (!callbacks.on_fail)
|
if (!s_running_models.constFind(this).value())
|
||||||
callbacks.on_fail = [this](QString reason) {
|
return;
|
||||||
if (!s_running_models.constFind(this).value())
|
searchRequestFailed(reason, -1);
|
||||||
return;
|
};
|
||||||
searchRequestFailed(reason, -1);
|
callbacks.on_abort = [this] {
|
||||||
};
|
if (!s_running_models.constFind(this).value())
|
||||||
if (!callbacks.on_abort)
|
return;
|
||||||
callbacks.on_abort = [this] {
|
searchRequestAborted();
|
||||||
if (!s_running_models.constFind(this).value())
|
};
|
||||||
return;
|
|
||||||
searchRequestAborted();
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!callbacks.on_succeed)
|
callbacks.on_succeed = [this](auto& doc, auto& pack) {
|
||||||
callbacks.on_succeed = [this](auto& doc, auto& pack) {
|
if (!s_running_models.constFind(this).value())
|
||||||
if (!s_running_models.constFind(this).value())
|
return;
|
||||||
return;
|
searchRequestForOneSucceeded(doc);
|
||||||
searchRequestForOneSucceeded(doc);
|
};
|
||||||
};
|
|
||||||
if (auto job = m_api->getProjectInfo({ projectId }, std::move(callbacks)); job)
|
if (auto job = m_api->getProjectInfo({ projectId }, std::move(callbacks)); job)
|
||||||
runSearchJob(job);
|
runSearchJob(job);
|
||||||
return;
|
return;
|
||||||
|
@ -168,12 +168,8 @@ void ListModel::performPaginatedSearch()
|
|||||||
if (!projectId.isEmpty()) {
|
if (!projectId.isEmpty()) {
|
||||||
ResourceAPI::ProjectInfoCallbacks callbacks;
|
ResourceAPI::ProjectInfoCallbacks callbacks;
|
||||||
|
|
||||||
// Use defaults if no callbacks are set
|
callbacks.on_fail = [this](QString reason) { searchRequestFailed(reason); };
|
||||||
if (!callbacks.on_fail)
|
callbacks.on_succeed = [this](auto& doc, auto& pack) { searchRequestForOneSucceeded(doc); };
|
||||||
callbacks.on_fail = [this](QString reason) { searchRequestFailed(reason); };
|
|
||||||
|
|
||||||
if (!callbacks.on_succeed)
|
|
||||||
callbacks.on_succeed = [this](auto& doc, auto& pack) { searchRequestForOneSucceeded(doc); };
|
|
||||||
static const FlameAPI api;
|
static const FlameAPI api;
|
||||||
if (auto job = api.getProjectInfo({ projectId }, std::move(callbacks)); job) {
|
if (auto job = api.getProjectInfo({ projectId }, std::move(callbacks)); job) {
|
||||||
jobPtr = job;
|
jobPtr = job;
|
||||||
|
@ -138,12 +138,8 @@ void ModpackListModel::performPaginatedSearch()
|
|||||||
if (!projectId.isEmpty()) {
|
if (!projectId.isEmpty()) {
|
||||||
ResourceAPI::ProjectInfoCallbacks callbacks;
|
ResourceAPI::ProjectInfoCallbacks callbacks;
|
||||||
|
|
||||||
// Use defaults if no callbacks are set
|
callbacks.on_fail = [this](QString reason) { searchRequestFailed(reason); };
|
||||||
if (!callbacks.on_fail)
|
callbacks.on_succeed = [this](auto& doc, auto& pack) { searchRequestForOneSucceeded(doc); };
|
||||||
callbacks.on_fail = [this](QString reason) { searchRequestFailed(reason); };
|
|
||||||
|
|
||||||
if (!callbacks.on_succeed)
|
|
||||||
callbacks.on_succeed = [this](auto& doc, auto& pack) { searchRequestForOneSucceeded(doc); };
|
|
||||||
static const ModrinthAPI api;
|
static const ModrinthAPI api;
|
||||||
if (auto job = api.getProjectInfo({ projectId }, std::move(callbacks)); job) {
|
if (auto job = api.getProjectInfo({ projectId }, std::move(callbacks)); job) {
|
||||||
jobPtr = job;
|
jobPtr = job;
|
||||||
|
Loading…
Reference in New Issue
Block a user