what could go wrong kekw
This commit is contained in:
parent
03c2cf1859
commit
e2b2aad3d6
@ -147,7 +147,7 @@ export default function () {
|
|||||||
const itemId = searchParams.get("id");
|
const itemId = searchParams.get("id");
|
||||||
const itemType = searchParams.get("type");
|
const itemType = searchParams.get("type");
|
||||||
|
|
||||||
const entryData: { [k: string]: any }[] = await queueReq.json();
|
let entryData: { [k: string]: any }[] = await queueReq.json();
|
||||||
const newEntries = [...entries];
|
const newEntries = [...entries];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -155,20 +155,27 @@ export default function () {
|
|||||||
itemType &&
|
itemType &&
|
||||||
["appeal", "gma", "inactivity", "report"].includes(itemType)
|
["appeal", "gma", "inactivity", "report"].includes(itemType)
|
||||||
) {
|
) {
|
||||||
const itemReq = await fetch(`/api/mod-queue/${itemType}/${itemId}`);
|
const specifiedItem = entryData.find((e) => e.id === itemId);
|
||||||
|
|
||||||
if (!itemReq.ok) {
|
if (specifiedItem) {
|
||||||
toast({
|
entryData = entryData.filter((entry) => entry.id !== specifiedItem.id);
|
||||||
description: ((await itemReq.json()) as { error: string }).error,
|
entryData.unshift(specifiedItem);
|
||||||
duration: 10000,
|
|
||||||
isClosable: true,
|
|
||||||
status: "error",
|
|
||||||
title: "Failed to load item with id " + itemId,
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
const itemData: { [k: string]: any } = await itemReq.json();
|
const itemReq = await fetch(`/api/mod-queue/${itemType}/${itemId}`);
|
||||||
|
|
||||||
entryData.unshift(itemData);
|
if (!itemReq.ok) {
|
||||||
|
toast({
|
||||||
|
description: ((await itemReq.json()) as { error: string }).error,
|
||||||
|
duration: 10000,
|
||||||
|
isClosable: true,
|
||||||
|
status: "error",
|
||||||
|
title: "Failed to load item with id " + itemId,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const itemData: { [k: string]: any } = await itemReq.json();
|
||||||
|
|
||||||
|
entryData.unshift(itemData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user