I'm currently working on a small project that involves using CodeIgniter, VueJs, and the Sweet Alert Javascript library. However, I encountered an error in my console stating
ReferenceError: "Swal is not defined"
when I try to call swall.fire({})
within my VueJs methods.
Here is a snippet of my code:
deleteCustomers(customer_id){
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
axios.post('/Thirdparty/deleteCustomers', {id : customer_id}).then(function(response){
console.log(response.data);
//alert(response.data.error);
Swal.fire(
'Deleted!',
'Your file has been deleted.',
'success'
);
});
});
}
It's worth noting that I have already imported Swall using: import Swal from 'sweetalert2';
NB: swall.fire only seems to fail inside Vuejs methods.