Created
May 10, 2021 00:51
-
-
Save iskenxan/24776c9f2b2157643df87a7c81b88632 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
processInventory = (action, widget) => { | |
displayLoader(); | |
return this.updateInventories(action, widget); | |
}; | |
updateInventories = (action, widget) => { | |
switch (action) { | |
case "REQUEST": { | |
const { first, inventoryItems } = this.requestInventory( | |
this.inventoryItems | |
); | |
this.inventoryItems = inventoryItems; | |
return first; | |
} | |
case "CLEAR": { | |
return this.clearInventory(); | |
} | |
case "ADD": { | |
return this.addToInventory(widget); | |
} | |
case "DELETE": { | |
return this.deleteFromInventory(widget); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment