Files
jandl-taskmanager-app/app/src/plugins/w@custom/axios
..
2023-11-30 17:27:00 +01:00
.
2023-02-01 15:04:03 +01:00
.
2023-02-01 15:04:03 +01:00
.
2023-02-01 15:04:03 +01:00

W / Axios

  • This plugin will add axios (this.$axios) with custom functions

Required internal plugins

  • w/auth

Installation

  1. Install plugin in main.ts
import axios from '@/plugins/w/axios'

const app = createApp(App)
	.use(auth)
	.use(axios)
  1. Create .env in app root directory
  2. Add VUE_APP_WAXIOS_URL=defaultBaseUrl to .env

Examples

  1. Call without authorization header
this.$axios.get('v1/courses')
  1. Call with authorization header
this.$axios.get_auth('v1/courses')
  1. Call that will return directly response.data.data
this.$axios.get_data('v1/courses')
this.$axios.get_auth_data('v1/courses')

Public functions

async get(url: string, config?: any)
async get_data(url: string, config?: any)
async get_auth(url: string, config?: any)
async get_auth_data(url: string, config?: any)

async post(url: string, config?: any)
async post_data(url: string, config?: any)
async post_auth(url: string, config?: any)
async post_auth_data(url: string, config?: any)

async patch(url: string, config?: any)
async patch_data(url: string, config?: any)
async patch_auth(url: string, config?: any)
async patch_auth_data(url: string, config?: any)

async delete(url: string, config?: any)
async delete_data(url: string, config?: any)
async delete_auth(url: string, config?: any)
async delete_auth_data(url: string, config?: any)