Skip to content

Instantly share code, notes, and snippets.

@DanielRamosAcosta
Created September 21, 2018 10:22
Show Gist options
  • Save DanielRamosAcosta/b9a3c352b3938fb33d0fbc45204d72a1 to your computer and use it in GitHub Desktop.
Save DanielRamosAcosta/b9a3c352b3938fb33d0fbc45204d72a1 to your computer and use it in GitHub Desktop.
import axios from "https://gist.githubusercontent.com/DanielRamosAcosta/2f773d815f5434f185c59aec1bab418c/raw/a442cdd8699e39ab9855cbaa571a79049a7b67d4/axios.ts"
// Make a request for a user with a given ID
axios.get('http://jsonplaceholder.typicode.com/users/1')
.then(response => {
// handle success
console.log("User name:", response.data.name);
})
.catch(error => {
// handle error
console.error("error:", error);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment