From afa5a4b76471c7a7de3adaaae75b3896ca6ea3f0 Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:50:18 -0400 Subject: [PATCH] Fix invalid hook call --- components/NewGameBan.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/NewGameBan.tsx b/components/NewGameBan.tsx index 390eac9..58a6cb4 100644 --- a/components/NewGameBan.tsx +++ b/components/NewGameBan.tsx @@ -27,6 +27,7 @@ import { useState } from "react"; export default function (props: { isOpen: boolean; onClose: () => void }) { const actionMap: { [k: string]: number } = {}; const [rows, setRows] = useState([] as JSX.Element[]); + const toast = useToast(); const fileTypes: { [k: string]: string } = { gif: "image/gif", heic: "image/heic", @@ -67,7 +68,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) { removeUser(user)}>Remove - + , ); } @@ -130,7 +131,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) { }); if (!submitReq.ok) { - useToast()({ + toast({ description: ((await submitReq.json()) as { error: string }).error, status: "error", title: "Failed to submit report", @@ -162,7 +163,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) { method: "POST", }); - useToast()({ + toast({ description: "Failed to upload file", status: "error", title: "Error", @@ -179,7 +180,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) { method: "POST", }); - useToast()({ + toast({ description: "User moderated", status: "success", title: "Success", @@ -209,7 +210,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) { 0 > 1 || user.match(/\W/) ) { - useToast()({ + toast({ description: "Check the username and try again", duration: 5000, isClosable: true,