Skip to content

Instantly share code, notes, and snippets.

@kpunith8
Created August 3, 2018 08:39
Show Gist options
  • Save kpunith8/b036834c0786007f286150de28df912c to your computer and use it in GitHub Desktop.
Save kpunith8/b036834c0786007f286150de28df912c to your computer and use it in GitHub Desktop.
Calling rest services - using axios
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