-
-
Save uno-de-piera/93851760d044c5531f01413e1fa27244 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
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