18 lines
313 B
TypeScript
18 lines
313 B
TypeScript
async function uploadFile(file:File,id: string): Promise<boolean> {
|
|
|
|
console.debug(file)
|
|
|
|
|
|
const res = await fetch(`/api/file?${new URLSearchParams({id:id}).toString()}`,{
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": file.type
|
|
},
|
|
body: file
|
|
})
|
|
|
|
return res.status == 200
|
|
}
|
|
|
|
export default uploadFile
|