|
- import Swal from "sweetalert2";
-
- export const msg = (text) => {
- Swal.mixin({
- toast: true,
- position: "bottom-end",
- showConfirmButton: false,
- timer: 3000,
- timerProgressBar: true,
- didOpen: (toast) => {
- toast.onmouseenter = Swal.stopTimer;
- toast.onmouseleave = Swal.resumeTimer;
- },
- }).fire({
- icon: "Success",
- title: text,
- });
- };
- export const deleteDialog = async (confirmAction, t) => {
- // const { t } = useTranslation("common")
- const result = await Swal.fire({
- icon: "question",
- title: t("Do you want to delete?"),
- cancelButtonText: t("Cancel"),
- confirmButtonText: t("Delete"),
- showCancelButton: true,
- showConfirmButton: true,
- customClass: {
- container: "swal-container-class", // Add a custom class to the Swal.fire container element
- popup: "swal-popup-class", // Add a custom class to the Swal.fire popup element
- },
- });
- if (result.isConfirmed) {
- confirmAction();
- }
- }
-
- export const popup = (text) => {
- Swal.fire(text);
- };
|