Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
It appears I forgot to remove that
  • Loading branch information
regalijan committed Oct 29, 2023
1 parent 82f2438 commit 2a49ebc
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions components/AppealCard.tsx
Expand Up @@ -17,13 +17,13 @@ import {
Text,
Textarea,
useDisclosure,
useToast
useToast,
} from "@chakra-ui/react";
import { useEffect, useState } from "react";

export default function(props: AppealCardProps & { port?: MessagePort }) {
export default function (props: AppealCardProps & { port?: MessagePort }) {
const [dateString, setDateString] = useState(
new Date(props.created_at).toUTCString()
new Date(props.created_at).toUTCString(),
);
const [action, setAction] = useState("");
const [feedback, setFeedback] = useState("");
Expand All @@ -46,9 +46,9 @@ export default function(props: AppealCardProps & { port?: MessagePort }) {
const actionReq = await fetch(`/api/appeals/${props.id}/${action}`, {
body: feedback ? JSON.stringify({ feedback }) : "{}",
headers: {
"content-type": "application/json"
"content-type": "application/json",
},
method: "POST"
method: "POST",
});

if (actionReq.ok) {
Expand All @@ -57,10 +57,8 @@ export default function(props: AppealCardProps & { port?: MessagePort }) {
description: `Appeal ${action === "accept" ? "accepted" : "denied"}`,
duration: 5000,
status: "success",
title: "Success"
title: "Success",
});

document.getElementById(`appeal_${props.id}`)?.remove();
} else {
let error;

Expand All @@ -74,7 +72,7 @@ export default function(props: AppealCardProps & { port?: MessagePort }) {
description: error,
duration: 10000,
status: "error",
title: "Oops!"
title: "Oops!",
});
}

Expand Down

0 comments on commit 2a49ebc

Please sign in to comment.