Skip to content

Commit

Permalink
Fix unstable network member list endpoint
Browse files Browse the repository at this point in the history
It was returning an array of array instead of
just array
  • Loading branch information
laduke committed Feb 22, 2024
1 parent 4167ac4 commit 9e406dc
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions controller/EmbeddedNetworkController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,26 +1094,26 @@ void EmbeddedNetworkController::configureHTTPControlPlane(

auto out = nlohmann::json::object();
auto meta = nlohmann::json::object();
auto members = nlohmann::json::array();
std::vector<json> memTmp;
if (_db.get(nwid, network, memTmp)) {
members.push_back(memTmp);
}

uint64_t authorizedCount = 0;
uint64_t totalCount = memTmp.size();
for (auto m = memTmp.begin(); m != memTmp.end(); ++m) {
bool a = OSUtils::jsonBool((*m)["authorized"], 0);
if (a) { authorizedCount++; }
}
uint64_t authorizedCount = 0;
uint64_t totalCount = memTmp.size();
for (auto m = memTmp.begin(); m != memTmp.end(); ++m) {
bool a = OSUtils::jsonBool((*m)["authorized"], 0);
if (a) { authorizedCount++; }
}

meta["totalCount"] = totalCount;
meta["authorizedCount"] = authorizedCount;
meta["totalCount"] = totalCount;
meta["authorizedCount"] = authorizedCount;

out["data"] = members;
out["meta"] = meta;
out["data"] = memTmp;
out["meta"] = meta;

setContent(req, res, out.dump());
setContent(req, res, out.dump());
} else {
res.status = 404;
return;
}
};
s.Get(memberListPath2, memberListGet2);
sv6.Get(memberListPath2, memberListGet2);
Expand Down

0 comments on commit 9e406dc

Please sign in to comment.