Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Create first part of updateQueue function
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 7c823d1 commit 090c190
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions pages/mod-queue.page.tsx
Expand Up @@ -4,6 +4,7 @@ import {
Flex,
Select,
useBreakpointValue,
useToast,
VStack,
} from "@chakra-ui/react";
import { useEffect, useState } from "react";
Expand All @@ -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">
Expand Down

0 comments on commit 090c190

Please sign in to comment.