Last active
December 28, 2016 10:50
-
-
Save mkusher/d8b9a30c53da83f01341bfc6fa218900 to your computer and use it in GitHub Desktop.
Handler example
This file contains 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
export class SomeHandler { | |
constructor(private http: Http) { } | |
@afterEvery(SomeCommand) | |
async handleSomeCommand(action: SomeCommand, dispatch: Dispatch) { | |
const withData = await this.http.get("/"); | |
dispatch(someEventHappened(withData)); | |
} | |
} |
This file contains 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
export const handleSomeCommand = (http: Http) => afterEvery(SomeCommand)( | |
async (action: SomeCommand, dispatch: Dispatch) => { | |
const withData = await http.get("/"); | |
dispatch(someEventHappened(withData)); | |
} | |
) |
This file contains 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
export class SomeHandler { | |
private http: Http | |
constructor(http: Http) { | |
this.http = http; | |
} | |
@afterEvery(SomeCommand) | |
async handleSomeCommand(action: SomeCommand, dispatch: Dispatch) { | |
const withData = await this.http.get("/"); | |
dispatch(someEventHappened(withData)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment