Skip to content

Instantly share code, notes, and snippets.

@cescoferraro
Created November 21, 2018 13:58
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 cescoferraro/f827c51c068a30a62b520b76010ebf35 to your computer and use it in GitHub Desktop.
Save cescoferraro/f827c51c068a30a62b520b76010ebf35 to your computer and use it in GitHub Desktop.
const pingEpic = (action$) => action$
.pipe(
filter((action: IAction) => action.type === 'PING'),
mergeMap((action: IAction) =>
ajax({
method: "GET",
url: apiURL() + "/party/" + action.payload
})
.pipe(
mergeMap((data) => {
return merge([
{ type: "hello", payload: {} },
{ type: "cama", payload: {} }
])
}),
catchError((error) => {
console.log(error)
return merge([{ type: "olga" }, { type: "errro" }])
})
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment