Last active
July 31, 2019 10:27
-
-
Save michielmulders/1ce264032d2625c715565c8d7008e446 to your computer and use it in GitHub Desktop.
Invoice Transaction Undo Asset
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
undoAsset(store) { | |
const sender = store.account.get(this.senderId); | |
// Rollback invoice count and IDs | |
sender.asset.invoiceCount = sender.asset.invoiceCount === 1 ? undefined : sender.asset.invoiceCount--; | |
sender.asset.invoicesSent = sender.asset.invoicesSent.length === 1 | |
? undefined | |
: sender.asset.invoicesSent.splice( | |
sender.asset.invoicesSent.indexOf(this.id), | |
1, | |
); | |
); | |
store.account.set(sender.address, sender); | |
return []; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment