Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created August 7, 2019 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/93851760d044c5531f01413e1fa27244 to your computer and use it in GitHub Desktop.
Save uno-de-piera/93851760d044c5531f01413e1fa27244 to your computer and use it in GitHub Desktop.
import { API, graphqlOperation } from "aws-amplify";
export default {
computed: {
mutationBatchDeletePosts() {
return `mutation BatchDeletePosts($ids: [ID]) {
batchDeletePosts(ids: $ids) {
id
}
}`;
}
},
methods: {
async removePosts(ids) {
if (!ids.length) return;
try {
await API.graphql(
graphqlOperation(this.mutationBatchDeletePosts, {
ids
})
);
} catch (e) {
// TODO maneja los errores
} finally {
// TODO oculta un preloader
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment