-
-
Save parzibyte/0d3a22e90aaca13fd8cda7f109de264f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async deleteGame(game) { | |
const result = await Swal.fire({ | |
title: 'Delete', | |
text: "Are you sure you want to delete this game?", | |
icon: 'question', | |
showCancelButton: true, | |
confirmButtonColor: '#1f9bcf', | |
cancelButtonColor: '#d9534f', | |
cancelButtonText: 'No', | |
confirmButtonText: 'Yes, delete it' | |
}); | |
// Stop if user did not confirm | |
if (!result.value) { | |
return; | |
} | |
const r = await fetch(SERVER_URL + "/game/" + game[0], { | |
method: "DELETE", | |
}); | |
const response = await r.json(); | |
if (response) { | |
this.$toasted.show("Deleted", { | |
position: "top-left", | |
duration: 1000, | |
}); | |
await this.getGames(); | |
} else { | |
this.$toasted.show("Something went wrong. Try again", { | |
position: "top-left", | |
duration: 1000, | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment