How to delete a record with sweet alert

 

First of all we have install sweet alert.

const onDeleteClick = async (id) => {
    confirmAlert({
      title: 'Confirm to delete',
      message: 'Are you sure to do this.',
      buttons: [
        {
          label: 'Yes',
          onClick: async () => {
            await webservice.post('', { cnno_no: id });
            getList();
          },
        },
        {
          label: 'No',
          onClick: () => {},
        },
      ],
    });
  };

Comments