Fix invalid hook call
This commit is contained in:
parent
dc8aae170b
commit
afa5a4b764
@ -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 }) {
|
||||
<Td>
|
||||
<Link onClick={() => removeUser(user)}>Remove</Link>
|
||||
</Td>
|
||||
</Tr>
|
||||
</Tr>,
|
||||
);
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user