Created
August 28, 2017 12:24
-
-
Save dzNavitski/a33b9e274e53217c406bc615d9909649 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
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