Created
March 19, 2018 17:47
-
-
Save israeleriston/8749dafd45cd197f034770613ba32de8 to your computer and use it in GitHub Desktop.
Axios and Vuejs Integration
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' | |
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