- storing changes for now
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user