Skip to content

Instantly share code, notes, and snippets.

@dcramer
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcramer/f825896f3acfea9b5b73 to your computer and use it in GitHub Desktop.
Save dcramer/f825896f3acfea9b5b73 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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