I'm trying to get the return value in sweetalert but I got this
Promise {<pending>}
>__proto_:Promise
[[PromiseStatus]]: "resolved"
[[PromiseValue]]:true
from this code
var ret = swal({
title: "Conflict",
text: "You have the same schedule with "+response.data.title,
icon: "warning",
buttons: {
cancel: {
text: "Save Anyway",
value: true,
visible: true
},
confirm: {
text: "Cancel",
value: null
}
}
})
.then((value) => {
if (value == true) {
return true;
} else {
return false;
}
});
console.log(ret); // Nag stop ko ani kay wala ko kabalo pa sa promise
What I want is to get to get the boolean value from the sweetalert. I'm trying this for hours but no luck.
I also tried this
console.log(ret.resolved);
console.log(ret.PromiseStatus);
and similar other but, got undefined
Has anyone tried what I did?