use a toast instead of alerting
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m1s
Publish Docker Image / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 59s

This commit is contained in:
Lee
2024-06-02 14:24:05 +01:00
parent af219e69bb
commit 78af91e971
2 changed files with 16 additions and 2 deletions

View File

@ -17,7 +17,7 @@ const upload = async () => {
if (!paste || paste.trim() === "") {
pasteInput.focus();
alert("Your paste is empty!");
toast("Please enter a paste to upload.");
return;
}
@ -35,6 +35,16 @@ const upload = async () => {
window.location.href = "/" + data.id;
} catch (error) {
console.error("Error:", error);
alert(`${error.message || "An error occurred while uploading the paste."}`);
toast(`${error.message || "An error occurred while uploading the paste."}`);
}
};
const toast = (message, duration = 3000) => {
Toastify({
text: message,
duration: duration,
close: true,
gravity: "bottom",
position: "right",
}).showToast();
};