Move useToast hook into main function component body
This commit is contained in:
parent
95ac964e62
commit
c2b8f6f054
@ -111,6 +111,7 @@ export default function () {
|
||||
const entryTypes = [];
|
||||
const [entries, setEntries] = useState([] as ReactElement[]);
|
||||
const [before, setBefore] = useState(Date.now());
|
||||
const toast = useToast();
|
||||
|
||||
for (const type of pageProps.entry_types)
|
||||
entryTypes.push(
|
||||
@ -131,7 +132,7 @@ export default function () {
|
||||
if (!queueReq.ok) {
|
||||
const errorData: { error: string } = await queueReq.json();
|
||||
|
||||
useToast()({
|
||||
toast({
|
||||
description: errorData.error,
|
||||
duration: 10000,
|
||||
isClosable: true,
|
||||
@ -157,7 +158,7 @@ export default function () {
|
||||
const itemReq = await fetch(`/api/mod-queue/${itemType}/${itemId}`);
|
||||
|
||||
if (!itemReq.ok) {
|
||||
useToast()({
|
||||
toast({
|
||||
description: ((await itemReq.json()) as { error: string }).error,
|
||||
duration: 10000,
|
||||
isClosable: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user