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 itemType = searchParams.get("type");
|
||||
|
||||
const entryData: { [k: string]: any }[] = await queueReq.json();
|
||||
let entryData: { [k: string]: any }[] = await queueReq.json();
|
||||
const newEntries = [...entries];
|
||||
|
||||
if (
|
||||
@ -155,20 +155,27 @@ export default function () {
|
||||
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) {
|
||||
toast({
|
||||
description: ((await itemReq.json()) as { error: string }).error,
|
||||
duration: 10000,
|
||||
isClosable: true,
|
||||
status: "error",
|
||||
title: "Failed to load item with id " + itemId,
|
||||
});
|
||||
if (specifiedItem) {
|
||||
entryData = entryData.filter((entry) => entry.id !== specifiedItem.id);
|
||||
entryData.unshift(specifiedItem);
|
||||
} 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