diff --git a/docs/src/pages/quasar-cli-webpack/ajax-requests.md b/docs/src/pages/quasar-cli-webpack/ajax-requests.md index 9c763325702..1c26e75e366 100644 --- a/docs/src/pages/quasar-cli-webpack/ajax-requests.md +++ b/docs/src/pages/quasar-cli-webpack/ajax-requests.md @@ -1,4 +1,21 @@ ---- +import { defineBoot } from '#q-app/wrappers' +import axios from 'axios' + +const api = axios.create({ baseURL: 'https://api.example.com' }) + +export default defineBoot(({ app }) => { + // for use inside Vue files (Options API) through this.$axios and this.$api + + app.config.globalProperties.$axios = axios + // ^ ^ ^ this will allow you to use this.$axios (for Vue Options API form) + // so you won't necessarily have to import axios in each vue file + + app.config.globalProperties.$api = api + // ^ ^ ^ this will allow you to use this.$api (for Vue Options API form) + // so you can easily perform requests against your app's API +}) + +export { axios, api }--- title: Ajax Requests desc: (@quasar/app-webpack) Using Axios for fetching data in a Quasar app. ---