- storing changes for now

This commit is contained in:
2025-10-28 09:54:29 +00:00
parent a64fa76ecb
commit 907555cb0d
4 changed files with 47 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
import { useMutation, useQuery } from "@tanstack/react-query";
import { CAM_BASE } from "../utils/config";
import { toast } from "sonner";
import { getOrCacheBlob } from "../utils/cacheSound";
const camBase = import.meta.env.MODE !== "development" ? CAM_BASE : CAM_BASE;
type UseFileUploadProps = {
@@ -22,11 +23,8 @@ const uploadFile = async (file: File) => {
const getUploadFiles = async ({ queryKey }: { queryKey: string[] }) => {
const [, fileName] = queryKey;
const response = await fetch(`${camBase}/Mobile/${fileName}`);
if (!response.ok) {
throw new Error("Cannot reach upload file endpoint");
}
return response.blob();
const url = `${camBase}/Mobile/${fileName}`;
return getOrCacheBlob(url);
};
export const useFileUpload = ({ queryKey }: UseFileUploadProps) => {