skyblock endpoint fix on different body

This commit is contained in:
NK 2023-03-01 21:32:33 +00:00
parent eb2e85c7f8
commit 8abc0fd1c0

View file

@ -8,9 +8,15 @@ async function decodeData(buffer) {
export default async function handler(req, res) { export default async function handler(req, res) {
if (req.method == "GET") { if (req.method == "GET") {
try {
const {ByteData} = JSON.parse(req.body); const {ByteData} = JSON.parse(req.body);
if (ByteData == undefined) if (ByteData == undefined)
res.status(400).json({error: "ByteData is undefined"}); res.status(400).json({error: "ByteData is undefined"});
} catch (e) {
const {ByteData} = req.body;
if (ByteData == undefined)
res.status(400).json({error: "ByteData is undefined"});
}
const data = await getItemNetworth((await decodeData(ByteData)).i[0], { const data = await getItemNetworth((await decodeData(ByteData)).i[0], {
cache: true, cache: true,
}); });