Laravel Precognition Vue - Change Default Axios Instance #47671
-
i need help , mean how to setup a custom axios instance for Laravel Precognition Vue, for example i need to setup the following axios instance to be used for Precognition.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can do this via the really backwards way JS works. Docs are here; https://laravel.com/docs/10.x/precognition#configuring-axios Effectively, in the file where you create your custom Axios instance, import the client from the laravel-precognition library and pass your instance to client.use(yourClientHere). That will update the client used internally for laravel-precognition. Please note; in my experience, the laravel docs are actually wrong, and you should import client from laravel-precognition not laravel-precognition-vue. Hope that helps you and others which find this. |
Beta Was this translation helpful? Give feedback.
Hi @msoubofficial
You can do this via the really backwards way JS works. Docs are here; https://laravel.com/docs/10.x/precognition#configuring-axios
Effectively, in the file where you create your custom Axios instance, import the client from the laravel-precognition library and pass your instance to client.use(yourClientHere).
That will update the client used internally for laravel-precognition.
Please note; in my experience, the laravel docs are actually wrong, and you should import client from laravel-precognition not laravel-precognition-vue.
Hope that helps you and others which find this.