i need some help with this , i try to use sweetalert2 with blazorise component delete , i want confirm before to delete a record, but i recive error , and dont stop on method awaited , and i dont know how to resolve .... i use .net core 6 , and blazorise 0.9.5.3
Error : 'An exception occurred executing JS interop: The JSON value could not be converted to System.Boolean. Path: $ | LineNumber: 0 | BytePositionInLine: 4.. See InnerException for more details.'
my code
[Inject] IJSRuntime js { get; set; }
private async Task OnRowRemoved(UsuarioArea usuarioArea)
{
bool confirmacion = false;
confirmacion = await js.InvokeAsync<bool>("customConfirm","Desasignar area","¿Quiere desasignar estar area?","question");
if (confirmacion)
{
Console.WriteLine("Si");
}else{
Console.WriteLine("No");
}
}
JS (Code From Felipe Gavilan, Youtuber)
function customConfirm(title, text, type) {
return new Promise(resolve => {
Swal.fire({
title,
text,
type,
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Si, Eliminar'
}).then((result) => {
resolve(result.isConfirmed);
})
});
}