* Executes request to delete a record to the GraphQL endpoint. * Can be replaced from a custom helper. * * @param {string} operation * @param {*} data of the record to be deleted.
(operation, data)
| 295 | * @param {*} data of the record to be deleted. |
| 296 | */ |
| 297 | _requestDelete(operation, data) { |
| 298 | const deleteOperation = this.factories[operation].revert(data) |
| 299 | const { query, variables } = deleteOperation |
| 300 | |
| 301 | return this.graphqlHelper.sendMutation(query, variables).then(response => { |
| 302 | const idx = this.created[operation].indexOf(data) |
| 303 | this.debugSection('Deleted', `record: ${response.data.data}`) |
| 304 | this.created[operation].splice(idx, 1) |
| 305 | }) |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | export default GraphQLDataFactory |