add file manager

This commit is contained in:
Qing
2022-12-31 21:07:08 +08:00
parent b847ded828
commit 2dd95be90d
17 changed files with 5402 additions and 5872 deletions

View File

@@ -164,3 +164,16 @@ export async function postInteractiveSeg(
throw new Error(`Something went wrong: ${error}`)
}
}
export async function getMediaFile(filename: string) {
const res = await fetch(`${API_ENDPOINT}/media/${filename}`, {
method: 'GET',
})
if (res.ok) {
const blob = await res.blob()
const file = new File([blob], filename)
return file
}
const errMsg = await res.text()
throw new Error(errMsg)
}