{"size": 975, "ext": "js", "max_stars_repo_path": "http/http-exercicios/src/plugins/axios.js", "max_stars_repo_name": "Kayofpimentel/vue-course", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "http/http-exercicios/src/plugins/axios.js", "max_issues_repo_name": "Kayofpimentel/vue-course", "max_issues_repo_issues_event_min_datetime": "2020-06-24T17:56:20.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T11:26:19.000Z", "max_forks_repo_path": "http/http-exercicios/src/plugins/axios.js", "max_forks_repo_name": "Kayofpimentel/vue-course", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 56, "max_forks_count": null, "avg_line_length": 27.8571428571, "max_line_length": 72, "alphanum_fraction": 0.5476923077}
import Vue from 'vue'
import axios from 'axios'

// axios.defaults.baseURL = 'https://curso-vue-modulo15.firebaseio.com/'
// axios.defaults.headers.common['Authorization'] = 'abc123'
// axios.defaults.headers.get['Accepts'] = 'application/json'

Vue.use({
    install(Vue){
        // Vue.prototype.$http = axios
        Vue.prototype.$http = axios.create({
            baseURL:"https://curso-vue-modulo15.firebaseio.com/",
            headers: {
                "Authorization" : "abc123"
            }
        })

        Vue.prototype.$http.interceptors.request.use(config => {
            return config
        },
        error => Promise.reject(error))

        Vue.prototype.$http.interceptors.response.use(res => {
            const array = []
            for(let chave in res.data){
                array.push({id: chave, ...res.data[chave]})
            }
            res.data = array
            return res
        }, error => Promise.reject(error))
    }

    

})