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.
27 lines
694 B
27 lines
694 B
import Swal from "sweetalert2";
|
|
import "../../scss/plugin/sweetalert.scss";
|
|
|
|
window.Swal = Swal.mixin({
|
|
target: '#swal-container',
|
|
})
|
|
|
|
window.toast = function (text, type = 'success') {
|
|
window.Swal.fire({
|
|
icon: type,
|
|
text: text,
|
|
toast: true,
|
|
position: 'top-end',
|
|
showConfirmButton: false,
|
|
timer: 3000,
|
|
timerProgressBar: true,
|
|
})
|
|
}
|
|
|
|
|
|
document.addEventListener('livewire:navigating', () => {
|
|
// If a user clicks a link while a SweetAlert is processing/open,
|
|
// cleanly destroy it so the overlay doesn't carry over to the new page.
|
|
if (window.Swal && window.Swal.isVisible()) {
|
|
window.Swal.close();
|
|
}
|
|
});
|
|
|