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