put -> patch

This commit is contained in:
Alex Holliday
2026-02-07 20:17:59 +00:00
parent b26d135a4f
commit f2b740a8f9
4 changed files with 4 additions and 110 deletions
@@ -1,105 +0,0 @@
import { useId } from "react";
import { Modal, Stack, Typography, Box } from "@mui/material";
import { useTheme } from "@mui/material/styles";
import { Button } from "@/Components/v2/inputs";
import { useTranslation } from "react-i18next";
interface ConfirmDialogProps {
open: boolean;
onClose: () => void;
title: string;
description?: string;
onConfirm: () => void;
confirmText?: string;
cancelText?: string;
isLoading?: boolean;
confirmColor?: "error" | "primary" | "secondary" | "success" | "warning" | "info";
}
export const ConfirmDialog = ({
open,
onClose,
title,
description,
onConfirm,
confirmText,
cancelText,
isLoading = false,
confirmColor = "error",
}: ConfirmDialogProps) => {
const theme = useTheme();
const { t } = useTranslation();
const titleId = useId();
const descriptionId = useId();
return (
<Modal
aria-labelledby={titleId}
aria-describedby={description ? descriptionId : undefined}
open={open}
onClose={onClose}
onClick={(e) => e.stopPropagation()}
>
<Stack
gap={2}
sx={{
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
minWidth: 400,
maxWidth: 500,
backgroundColor: theme.palette.background.paper,
border: 1,
borderColor: theme.palette.divider,
borderRadius: 1,
boxShadow: 24,
p: 4,
"&:focus": {
outline: "none",
},
}}
>
<Typography
id={titleId}
variant="h6"
fontWeight={600}
>
{title}
</Typography>
{description && (
<Typography
id={descriptionId}
color="text.secondary"
>
{description}
</Typography>
)}
<Box
sx={{
display: "flex",
justifyContent: "flex-end",
gap: 2,
mt: 2,
}}
>
<Button
variant="outlined"
onClick={onClose}
disabled={isLoading}
>
{cancelText ?? t("common.buttons.cancel")}
</Button>
<Button
variant="contained"
color={confirmColor}
onClick={onConfirm}
loading={isLoading}
>
{confirmText ?? t("common.buttons.confirm")}
</Button>
</Box>
</Stack>
</Modal>
);
};
@@ -19,4 +19,3 @@ export * from "./Gauge";
export * from "./Tabs";
export * from "./SplitBox";
export * from "./TextLink";
export * from "./ConfirmDialog";
+1 -1
View File
@@ -374,7 +374,7 @@ class NetworkService {
* @param {Object} config - The configuration object.
* @param {string} config.userId - The ID of the user to be updated.
* @param {Object} config.form - The form data for the user to be updated.
* @returns {Promise<AxiosResponse>} The response from the axios PUT request.
* @returns {Promise<AxiosResponse>} The response from the axios PATCH request.
*
*/
async updateUser(config) {
+3 -3
View File
@@ -26,10 +26,10 @@ class AuthRoutes {
this.router.get("/users", verifyJWT, isAllowed(["admin", "superadmin"]), this.authController.getAllUsers);
this.router.get("/users/:userId", verifyJWT, isAllowed(["superadmin"]), this.authController.getUserById);
this.router.put("/users/:userId", verifyJWT, isAllowed(["superadmin"]), this.authController.editUserById);
this.router.put("/users/:userId/password", verifyJWT, isAllowed(["superadmin"]), this.authController.editUserPasswordById);
this.router.patch("/users/:userId", verifyJWT, isAllowed(["superadmin"]), this.authController.editUserById);
this.router.patch("/users/:userId/password", verifyJWT, isAllowed(["superadmin"]), this.authController.editUserPasswordById);
this.router.put("/user", verifyJWT, upload.single("profileImage"), this.authController.editUser);
this.router.patch("/user", verifyJWT, upload.single("profileImage"), this.authController.editUser);
this.router.delete("/user", verifyJWT, this.authController.deleteUser);
}