Shortcodes

This commit is contained in:
cdricms
2025-02-10 08:52:32 +01:00
parent a7ad045631
commit 8e87d834bc
20 changed files with 485 additions and 71 deletions

View File

@@ -16,7 +16,6 @@ import { PhotoDialog } from "@/components/photo-dialog";
import useFileUpload from "@/hooks/use-file-upload";
import useMedia from "@/hooks/use-media";
import Media from "@/interfaces/Media";
import useApiMutation from "@/hooks/use-api";
import request from "@/lib/request";
export default function PhotoGallery() {
@@ -41,8 +40,22 @@ export default function PhotoGallery() {
});
};
const handleUpdatePhoto = (updatedPhoto: Omit<Media, "id">) => {
const handleUpdatePhoto = async (
body: Media | Omit<Media, "id">,
file: File,
) => {
if (selectedPhoto) {
const res = await request<Media>(
`/media/${selectedPhoto.id}/update`,
{
method: "PATCH",
requiresAuth: true,
body,
},
);
if (res.status === "Success") {
mutate();
}
}
setSelectedPhoto(null);
};