It appears I forgot to remove that

This commit is contained in:
Regalijan 2023-10-29 00:00:56 -04:00
parent 82f2438231
commit 2a49ebc845
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -17,13 +17,13 @@ import {
Text, Text,
Textarea, Textarea,
useDisclosure, useDisclosure,
useToast useToast,
} from "@chakra-ui/react"; } from "@chakra-ui/react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
export default function(props: AppealCardProps & { port?: MessagePort }) { export default function (props: AppealCardProps & { port?: MessagePort }) {
const [dateString, setDateString] = useState( const [dateString, setDateString] = useState(
new Date(props.created_at).toUTCString() new Date(props.created_at).toUTCString(),
); );
const [action, setAction] = useState(""); const [action, setAction] = useState("");
const [feedback, setFeedback] = useState(""); const [feedback, setFeedback] = useState("");
@ -46,9 +46,9 @@ export default function(props: AppealCardProps & { port?: MessagePort }) {
const actionReq = await fetch(`/api/appeals/${props.id}/${action}`, { const actionReq = await fetch(`/api/appeals/${props.id}/${action}`, {
body: feedback ? JSON.stringify({ feedback }) : "{}", body: feedback ? JSON.stringify({ feedback }) : "{}",
headers: { headers: {
"content-type": "application/json" "content-type": "application/json",
}, },
method: "POST" method: "POST",
}); });
if (actionReq.ok) { if (actionReq.ok) {
@ -57,10 +57,8 @@ export default function(props: AppealCardProps & { port?: MessagePort }) {
description: `Appeal ${action === "accept" ? "accepted" : "denied"}`, description: `Appeal ${action === "accept" ? "accepted" : "denied"}`,
duration: 5000, duration: 5000,
status: "success", status: "success",
title: "Success" title: "Success",
}); });
document.getElementById(`appeal_${props.id}`)?.remove();
} else { } else {
let error; let error;
@ -74,7 +72,7 @@ export default function(props: AppealCardProps & { port?: MessagePort }) {
description: error, description: error,
duration: 10000, duration: 10000,
status: "error", status: "error",
title: "Oops!" title: "Oops!",
}); });
} }