Instantly share code, notes, and snippets.

Embed
What would you like to do?
api.assign() =>
AssignAction(...)
this.request('...')
.success(() => AssignSuccessAction())
.error(() => AssignErrorAction())
ThingStore =>
onAssign:
// we want to emulate a Set() for this
item.state.assignInProgress = true;
onAssignSuccess:
item.state.assignInProgress = false;
onAssignError:
item.state.assignInProgress = false;
AddAlertAction('there was an error and theres no good way for us to tell the component about it')
AssignComponent =>
render() {
if item.state.assignInProgress
return 'in progress'
else
return '<a ...>'
}
@dcramer

This comment has been minimized.

Owner

dcramer commented Feb 4, 2015

It seems that if we wanted AssignComponent to know about an error we'd again have to assign it to something arbitrary like item.errors.assign => ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment