Skip to content

Instantly share code, notes, and snippets.

@velopert
Created August 11, 2016 05:03
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 velopert/8007d31943af8b6d1b42150523fb06d3 to your computer and use it in GitHub Desktop.
Save velopert/8007d31943af8b6d1b42150523fb06d3 to your computer and use it in GitHub Desktop.
export function searchRequest(username) {
return (dispatch) => {
dispatch(search);
if(username==='') {
return new Promise((resolve, reject)=> {
dispatch(searchSuccess([]));
resolve();
});
}
return axios.get('/api/account/search/' + username)
.then(
(response) => {
dispatch(searchSuccess(response.data));
}
).catch(
(error) => {
dispatch(searchError());
}
);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment