-
-
Save velopert/8007d31943af8b6d1b42150523fb06d3 to your computer and use it in GitHub Desktop.
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 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