Skip to content

Instantly share code, notes, and snippets.

@dzNavitski
Created August 28, 2017 12:24
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 dzNavitski/a33b9e274e53217c406bc615d9909649 to your computer and use it in GitHub Desktop.
Save dzNavitski/a33b9e274e53217c406bc615d9909649 to your computer and use it in GitHub Desktop.
export const apiValidate = action$ => {
return action$.ofType(validateRequestAction)
.debounceTime(250)
.switchMap((action) => (
Observable.ajax({
url: url,
method: 'GET',
crossDomain: true,
headers: {
"Content-Type": 'application/json'
},
responseType: 'json'
})
.map(payload => (new APISuccessValidate()))
.catch(payload => ([new APIFailureValidate()]))
))
.takeUntil(action$.ofType(validateCancelAction))
.repeat();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment