Last active
August 29, 2015 14:14
-
-
Save dcramer/f825896f3acfea9b5b73 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
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 ...>' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 => ...