- added new sound files

- new functionality to upload files
- need to get and locatate uploaded files
This commit is contained in:
2025-10-22 11:51:37 +01:00
parent df6bf75184
commit 4519700561
7 changed files with 51 additions and 12 deletions

View File

@@ -4,10 +4,12 @@ import type { SoundUploadValue } from "../../../types/types";
import { useSoundContext } from "../../../context/SoundContext";
import { toast } from "sonner";
import { useCameraBlackboard } from "../../../hooks/useCameraBlackboard";
import { useFileUpload } from "../../../hooks/useFileUpload";
const SoundUpload = () => {
const { state, dispatch } = useSoundContext();
const { mutation } = useCameraBlackboard();
const { mutation: fileMutation } = useFileUpload();
const initialValues: SoundUploadValue = {
name: "",
@@ -37,10 +39,10 @@ const SoundUpload = () => {
path: "soundSettings",
value: updatedValues,
});
const responsee = await fileMutation.mutateAsync(values.soundFile);
console.log(responsee);
if (result.reason !== "OK") {
toast.error("Cannot update sound settings");
} else {
toast.success(`${values.name} file added`);
}
dispatch({ type: "ADD", payload: values });