[Vuejs]-Does Vuejs have similar API to remote asynchronous http calls (Ajax) as jQuery?

1๐Ÿ‘

โœ…

I am using axios as HTTP client for making api calls, I have created a gateways folder in my src folder and I have put files for each backend, creating axios instances, like following

myApi.js

import axios from 'axios'
export default axios.create({
  baseURL: 'http://localhost:3000/api/v1',
  timeout: 5000,
  headers: {
    'X-Auth-Token': 'f2b6637ddf355a476918940289c0be016a4fe99e3b69c83d',
    'Content-Type': 'application/json'
  }
})

You can look at detailed answer related to this here and here.

๐Ÿ‘คSaurabh

1๐Ÿ‘

Yes, as a separate file that you call from your page:
https://github.com/pagekit/vue-resource

Leave a comment