Skip to content

Instantly share code, notes, and snippets.

@iskenxan
Created May 10, 2021 00:50
Show Gist options
  • Save iskenxan/d303ff62a83ec548e76ebc6c7185d3fa to your computer and use it in GitHub Desktop.
Save iskenxan/d303ff62a83ec548e76ebc6c7185d3fa to your computer and use it in GitHub Desktop.
processInventory = (widget) => {
displayLoader();
switch (this.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);
}
default:
break;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment