add mask tab

This commit is contained in:
Qing
2024-08-12 12:13:37 +08:00
parent 60b1411d6b
commit 820ce5e4d0
11 changed files with 121 additions and 58 deletions

View File

@@ -135,7 +135,7 @@ export async function runPlugin(
body: JSON.stringify({
name,
image: imageBase64,
scale:upscale,
scale: upscale,
clicks,
}),
})
@@ -167,6 +167,23 @@ export async function getMediaFile(tab: string, filename: string) {
throw new Error(errMsg.errors)
}
export async function getMediaBlob(tab: string, filename: string) {
const res = await fetch(
`${API_ENDPOINT}/media_file?tab=${tab}&filename=${encodeURIComponent(
filename
)}`,
{
method: "GET",
}
)
if (res.ok) {
const blob = await res.blob()
return blob
}
const errMsg = await res.json()
throw new Error(errMsg.errors)
}
export async function getMedias(tab: string): Promise<Filename[]> {
const res = await api.get(`medias`, { params: { tab } })
return res.data