feat: enhance user feedback with toast notifications for various actions and errors

This commit is contained in:
maxDorninger
2025-05-24 20:58:54 +02:00
parent 6513065ba8
commit 0ea500bacd
7 changed files with 64 additions and 26 deletions

View File

@@ -35,13 +35,15 @@
requests[requestIndex].authorized = !currentAuthorizedStatus;
requests[requestIndex].authorized_by = user();
}
toast.success(`Request ${!currentAuthorizedStatus ? 'approved' : 'unapproved'} successfully.`);
} else {
console.error(`Failed to update request status ${response.statusText}`, await response.text());
// Optionally, add user-facing error handling here
const errorText = await response.text();
console.error(`Failed to update request status ${response.statusText}`, errorText);
toast.error(`Failed to update request status: ${response.statusText}`);
}
} catch (error) {
console.error('Error updating request status:', error);
// Optionally, add user-facing error handling here
toast.error('Error updating request status: ' + (error instanceof Error ? error.message : String(error)));
}
}