ITHC: enforce administrative case deletion authorization
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
import { useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { bytesToSize } from "../../../components/utils";
|
||||
import { deleteAwaitingSubmissionsFromBlob } from "../../../actions/services/documentService";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
|
||||
import { formatBlobDates } from "../utils/adminHelper";
|
||||
@@ -136,20 +135,52 @@ export default function StorageTab({ data, repCompleteCount }) {
|
||||
{folder.hasTmpFile && (
|
||||
<>
|
||||
<button
|
||||
onClick={() => {
|
||||
confirm(
|
||||
"Do you want to remove this unsubmitted appeal " +
|
||||
folder.folderPath +
|
||||
"?\n"
|
||||
) &&
|
||||
(deleteCaseItem(
|
||||
c.container,
|
||||
folder.folderPath,
|
||||
setData
|
||||
),
|
||||
onClick={async () => {
|
||||
if (
|
||||
!confirm(
|
||||
"Do you want to remove this unsubmitted appeal " +
|
||||
folder.folderPath +
|
||||
"?\n"
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response =
|
||||
await fetch(
|
||||
"/api/admin/deleteblobcase",
|
||||
{
|
||||
method: "POST",
|
||||
headers:
|
||||
{
|
||||
"Content-Type":
|
||||
"application/json"
|
||||
},
|
||||
body: JSON.stringify(
|
||||
{
|
||||
container:
|
||||
c.container,
|
||||
casefolderID:
|
||||
folder.folderPath
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
"Unable to delete case"
|
||||
);
|
||||
}
|
||||
|
||||
alert(
|
||||
"Temp case Deleted!"
|
||||
));
|
||||
);
|
||||
window.location.reload();
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Delete this TMP appeal
|
||||
|
||||
Reference in New Issue
Block a user