Merge pull request #117 from hzrd149/blossom-uploads

Improve upload error handling
This commit is contained in:
gsovereignty
2024-08-20 21:38:06 +08:00
committed by GitHub
3 changed files with 27 additions and 11 deletions

View File

@@ -29,6 +29,8 @@
if (file) {
const blob = await uploadBlob(file, $userServers);
if (!blob) throw new Error('All servers failed');
// Insert the image URL into the textarea
const insert = blob.url;
const textarea = event.target as HTMLTextAreaElement;

View File

@@ -22,6 +22,9 @@
try {
dispatch('uploading');
const blob = await uploadBlob(file, $userServers);
if (!blob) throw new Error('All servers failed');
dispatch('uploaded', blob);
} catch (error) {
if (error instanceof Error) alert(`Failed to upload image: ${error.message}`);