fix: fix network member api resp handling

filter controller peer
handle undefined
write exp msg to error msg
This commit is contained in:
Syrone Wong 2023-05-31 11:15:00 +08:00 committed by dec0dOS
parent db8f4979e6
commit 856682bad1
2 changed files with 21 additions and 11 deletions

View file

@ -12,12 +12,12 @@ router.get("/", auth.isAuthorized, async function (req, res) {
api
.get("controller/network/" + nwid + "/member")
.then(async function (controllerRes) {
const mids = Object.keys(controllerRes.data);
const mids = controllerRes.data.map((i) => Object.keys(i)[0]);
const data = await member.getMembersData(nwid, mids);
res.send(data);
})
.catch(function () {
res.status(404).send({ error: "Network not found" });
.catch(function (err) {
res.status(404).send({ error: `Network not found ${err}` });
});
});