fix
This commit is contained in:
parent
8abc0fd1c0
commit
35f273b3ea
1 changed files with 6 additions and 8 deletions
|
@ -5,19 +5,17 @@ async function decodeData(buffer) {
|
||||||
const parsedNbt = await parseNbt(Buffer.from(buffer, "base64"));
|
const parsedNbt = await parseNbt(Buffer.from(buffer, "base64"));
|
||||||
return nbt.simplify(parsedNbt);
|
return nbt.simplify(parsedNbt);
|
||||||
}
|
}
|
||||||
|
let dat;
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
if (req.method == "GET") {
|
if (req.method == "GET") {
|
||||||
try {
|
try {
|
||||||
const {ByteData} = JSON.parse(req.body);
|
dat = JSON.parse(req.body).ByteData;
|
||||||
if (ByteData == undefined)
|
|
||||||
res.status(400).json({error: "ByteData is undefined"});
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const {ByteData} = req.body;
|
dat = req.body.ByteData;
|
||||||
if (ByteData == undefined)
|
|
||||||
res.status(400).json({error: "ByteData is undefined"});
|
|
||||||
}
|
}
|
||||||
const data = await getItemNetworth((await decodeData(ByteData)).i[0], {
|
if (dat == undefined)
|
||||||
|
res.status(400).json({error: "ByteData is undefined"});
|
||||||
|
const data = await getItemNetworth((await decodeData(dat)).i[0], {
|
||||||
cache: true,
|
cache: true,
|
||||||
});
|
});
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
|
|
Loading…
Reference in a new issue