create an api to close the modal when user choose confirm