cretueusebiu / vform

Handle Laravel-Vue forms and validation with ease.
https://vform.vercel.app
MIT License
607 stars 120 forks source link

How can i use baseUrl of axois (vuexy theme config) #121

Closed fawel11 closed 3 years ago

fawel11 commented 3 years ago

At first many many great thanks for your contribution. It reduces huge task to validate using laravel validation. I am facing a simple problem here. I use global vform (window.Form = Form;). Recently i add this package with vuexy theme which uses axios configure : `import Vue from 'vue'

// axios import axios from 'axios'

const axiosIns = axios.create({ // You can add your headers here // ================================ baseURL: 'http://eduapi.test/api/', // timeout: 1000, // headers: {'X-Custom-Header': 'foobar'} })

Vue.prototype.$http = axiosIns

export default axiosIns When i use this.form .post("/api/auth/login")`

it returns 400 as it adds localhost with url! I need to set a base url of my api applicaion, Lumen. Like(myapi.test/api/auth/login)--local env.

How can combine this config with vform?

cretueusebiu commented 3 years ago

You can set a custom axios instance like this:

Form.axios = myAxiosInstance