From 7c2e8f00ad344f9b2dbae695fee26697766411a6 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 11 Dec 2024 18:04:10 -0800 Subject: [PATCH] web: custom action per review button --- .../[submissionId]/_reviewButtons.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/web/src/app/submissions/[submissionId]/_reviewButtons.tsx b/web/src/app/submissions/[submissionId]/_reviewButtons.tsx index 9f226f8..f5a3a14 100644 --- a/web/src/app/submissions/[submissionId]/_reviewButtons.tsx +++ b/web/src/app/submissions/[submissionId]/_reviewButtons.tsx @@ -1,8 +1,10 @@ import { Button, ButtonOwnProps } from "@mui/material"; type Review = "Completed" | "Submit" | "Reject" | "Revoke" | "Validate" | "Publish" +type Action = "completed" | "submit" | "reject" | "revoke" | "trigger-validate" | "trigger-publish" interface ReviewButton { name: Review, + action: Action, color: ButtonOwnProps["color"] } @@ -25,8 +27,8 @@ interface ReviewButton { // -X POST \ // localhost:8081/v1/submissions/1/status/submit -function ReviewButtonClicked(type: Review) { - const post = fetch(`http://localhost:8081/v1/submissions/1/status/${type.toLowerCase()}`, { +function ReviewButtonClicked(action: Action) { + const post = fetch(`http://localhost:8081/v1/submissions/1/status/${action}`, { method: "POST", headers: { "Content-type": "application/json", @@ -36,18 +38,18 @@ function ReviewButtonClicked(type: Review) { } function ReviewButton(props: ReviewButton) { - return + return } export default function ReviewButtons() { return (
- - - - - - + + + + + +
) -} \ No newline at end of file +}