Created
July 19, 2021 13:14
-
-
Save mercykip/a2436dc649ca0c0361943ecf5b0289da 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
| /// add a new user | |
| export const addUserAction = (user) => { | |
| return (dispatch) => { | |
| /// axios is a library used to make request to an API, | |
| /// return data and manipulate the data . | |
| axios.post('https://ti-react-test.herokuapp.com/users', user) | |
| .then(response => { | |
| console.log(response); | |
| dispatch(addUser(response.data)) | |
| }) | |
| .catch(error => { | |
| console.log("eror", error); | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment