{
Swal.fire({
text: text,
}).then((result) => {
return result.isConfirmed;
});
}
But before it reaches to "THEN", it return an voi.
For example if I use that function like this:
if(confirmsweetalert('test'))
{
console.log('Okeye');
}
it throws an error.
can anyone help me?
Read about async programming. Your function returns nothing at all, causing the if condition to be falsy. It then runs the Swal stuff, and some random time later the promise resolves, and runs the .then function.
You shoud return the swal function
Обсуждают сегодня