Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move useToast hook into main function component body
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 95ac964 commit c2b8f6f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/routes/mod-queue.tsx
Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit c2b8f6f

Please sign in to comment.