fix delete check

This commit is contained in:
2023-02-04 10:29:39 +08:00
parent 80593e3805
commit 3ec781cc76

View File

@@ -12,7 +12,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
});
return;
}
const json = JSON.parse(req.body);
const json = req.body;
console.log("request", json);
if (json.checked) {
let count = 0;
@@ -36,6 +36,13 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
}
store[json.name] = json.user;
} else {
// check whether the request name match the taken name
if (store[json.name] !== json.user) {
res.status(403).json({
error: `失败:您未选择到当前位置`,
})
return;
}
delete store[json.name];
}
}