Let me ask what type of data you have? If it is an array, it is best to check like this.
if (response.status === 200 && response.data && response.data.length > 0) { handleClose(); }