I promise

This commit is contained in:
Violet Caulfield
2025-01-26 09:09:02 -06:00
parent 9cbc8c9626
commit 9b32f0195d
+9 -8
View File
@@ -32,14 +32,15 @@ export async function fetchItemImage(
})
.then(async ({ data } : { data: Blob }) => {
console.debug(URL.createObjectURL(data));
FileSystem.writeFile(
getImagePath(itemId, imageType, width, height),
await data.text()
).then(() => {
resolve(URL.createObjectURL(data));
})
data.text()
.then((text) => {
FileSystem.writeFile(
getImagePath(itemId, imageType, width, height),
text
).then(() => {
resolve(URL.createObjectURL(data));
})
})
})
.catch(error => {
reject(error)