Create first part of updateQueue function
This commit is contained in:
parent
7c823d1f8b
commit
090c190b21
@ -4,6 +4,7 @@ import {
|
||||
Flex,
|
||||
Select,
|
||||
useBreakpointValue,
|
||||
useToast,
|
||||
VStack,
|
||||
} from "@chakra-ui/react";
|
||||
import { useEffect, useState } from "react";
|
||||
@ -15,11 +16,23 @@ export function Page(pageProps: { [p: string]: any }) {
|
||||
for (const type of pageProps.entry_types)
|
||||
entryTypes.push(<option value={type.value}>{type.name}</option>)
|
||||
|
||||
useEffect(() => {
|
||||
(async function () {
|
||||
const queueRequest = await fetch("/api/mod-queue")
|
||||
})();
|
||||
}, []);
|
||||
async function updateQueue(queue_type: string, include_closed: boolean = false): Promise<void> {
|
||||
const queueReq = await fetch(`/api/mod-queue/list?type=${queue_type}&includeClosed=${include_closed}`);
|
||||
|
||||
if (!queueReq.ok) {
|
||||
const errorData: { error: string } = await queueReq.json();
|
||||
|
||||
useToast()({
|
||||
description: errorData.error,
|
||||
duration: 10000,
|
||||
isClosable: true,
|
||||
status: "error",
|
||||
title: "Failed to load queue",
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Container maxW="container.xl">
|
||||
|
Loading…
x
Reference in New Issue
Block a user