Skip to content

Instantly share code, notes, and snippets.

@ShariqT
Created December 6, 2021 23:56
Show Gist options
  • Save ShariqT/8377413d424d58a8c47fc8d71bb51b6d to your computer and use it in GitHub Desktop.
Save ShariqT/8377413d424d58a8c47fc8d71bb51b6d to your computer and use it in GitHub Desktop.
list-postcards3.vue
<script setup>
// other code
function cancel(id) {
fetch(`http://localhost:3030/postcard/cancel/${id}`)
.then((data) => data.json())
.then((data) => {
if (data.deleted) {
postcards.value = postcards.value.filter(postcard => postcard.id !== id)
}
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment