Skip to content

Instantly share code, notes, and snippets.

@p14n
Created May 15, 2018 20:14
Show Gist options
  • Save p14n/1286b1098cde4e93109976360f5ecb1e to your computer and use it in GitHub Desktop.
Save p14n/1286b1098cde4e93109976360f5ecb1e to your computer and use it in GitHub Desktop.
Reducer
const eventAction = (state = {}, action) => {
switch (action.type) {
...
case "event":
...
switch (action.name) {
case "created":
if (state.account == action.from) {
return { ...state, events: ev, status: "reclaimable" };
} else {
return { ...state, events: ev, status: "payable" };
}
case "paid":
return { ...state, events: ev, status: "" };
...
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment