FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 line
1.0 KiB

  1. import Swal from "sweetalert2";
  2. export const msg = (text) => {
  3. Swal.mixin({
  4. toast: true,
  5. position: "bottom-end",
  6. showConfirmButton: false,
  7. timer: 3000,
  8. timerProgressBar: true,
  9. didOpen: (toast) => {
  10. toast.onmouseenter = Swal.stopTimer;
  11. toast.onmouseleave = Swal.resumeTimer;
  12. },
  13. }).fire({
  14. icon: "Success",
  15. title: text,
  16. });
  17. };
  18. export const deleteDialog = async (confirmAction, t) => {
  19. // const { t } = useTranslation("common")
  20. const result = await Swal.fire({
  21. icon: "question",
  22. title: t("Do you want to delete?"),
  23. cancelButtonText: t("Cancel"),
  24. confirmButtonText: t("Delete"),
  25. showCancelButton: true,
  26. showConfirmButton: true,
  27. customClass: {
  28. container: "swal-container-class", // Add a custom class to the Swal.fire container element
  29. popup: "swal-popup-class", // Add a custom class to the Swal.fire popup element
  30. },
  31. });
  32. if (result.isConfirmed) {
  33. confirmAction();
  34. }
  35. }
  36. export const popup = (text) => {
  37. Swal.fire(text);
  38. };