Created
August 3, 2018 08:39
-
-
Save kpunith8/b036834c0786007f286150de28df912c to your computer and use it in GitHub Desktop.
Calling rest services - using axios
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
import axios from 'axios'; | |
const getUsers = (id) => { | |
return axios.get('http://localhost:3000/users/'.concat(id)); | |
} | |
const validateUser = (userName, password) => { | |
// if (userName.length > 0 && password.length > 0) { | |
// return true; | |
// } | |
// else { | |
// return false; | |
// } | |
return axios.post('http://localhost:3000/userLogin', { | |
userName: userName, | |
password: password | |
}); | |
} | |
export { | |
getUsers, validateUser | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment