How to check existing image in database using alert and after it will pop up save button

can alert function using if statement in this code

presentPrompt() {
const alert = this.alertCtrl.create({
title: ‘Login’,
inputs: [
{
name: ‘username’,
placeholder: ‘Username’
},
{
name: ‘password’,
placeholder: ‘Password’,
type: ‘password’
}
],
buttons: [
{
text: ‘Cancel’,
role: ‘cancel’,
handler: data => {
console.log(‘Cancel clicked’);
}
},
{
text: ‘Login’,
handler: data => {
if (User.isValid(data.username, data.password)) {
// logged in!
} else {
// invalid login
return false;
}
}
}
]
});
alert.present();
}