Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion docs/src/pages/quasar-cli-webpack/ajax-requests.md
Original file line number Diff line number Diff line change
@@ -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.
---
Expand Down