I need to migrate my sweetalert1 JS plugin to Sweetalert2 Plugin.
However I am at a complete loss on how to migrate the following code:
swal("A wild Pikachu appeared! What do you want to do?", {
buttons: {
cancel: "Run away!",
catch: {
text: "Throw Pokéball!",
value: "catch",
},
defeat: true,
},
})
.then((value) => {
switch (value) {
case "defeat":
swal("Pikachu fainted! You gained 500 XP!");
break;
case "catch":
swal("Gotcha!", "Pikachu was caught!", "success");
break;
default:
swal("Got away safely!");
}
});
sweetalert1: https://sweetalert.js.org/guides/#advanced-examples
sweetalert2: https://sweetalert2.github.io/
Any help in formatting the code to sweetalert2 please?