Skip to content

Instantly share code, notes, and snippets.

@israeleriston
Created March 19, 2018 17:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save israeleriston/8749dafd45cd197f034770613ba32de8 to your computer and use it in GitHub Desktop.
Save israeleriston/8749dafd45cd197f034770613ba32de8 to your computer and use it in GitHub Desktop.
Axios and Vuejs Integration
import axios from 'axios'
export const http = axios.create({
baseURL: process.env.SUA_API
})
export default function install (Vue) {
Object.defineProperty(Vue.prototype, '$http', {
get: () => http
})
}
// this component call this.$http.get('/here-api')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment