Questions on use with axios. #29
-
Can you please confirm if its using axios.
Also we are using axios already , and have configured an interceptor like this.
I think we wont need to configure crsf iterceptor anymore , but can how can we configure the other interceptors. Maybe an example.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I got the answer for the first and the third question by looking at the ping-crm repo. |
Beta Was this translation helpful? Give feedback.
-
Hi Rachit, I'll answer all three in case someone runs into this.
You should configure # config/initializers/js_from_routes.rb
if Rails.env.development?
JsFromRoutes.config do |config|
config.client_library = '@js-from-routes/axios'
end
end Make sure to regenerate the helpers after making this change.
You can modify the configuration by importing import { AxiosConfig } from '@js-from-routes/axios'
AxiosConfig.instance = httpClient
Read this section in the docs. It's usually convenient to configure it before any requests are fired, so importing a file that does the configuration at the start of an entrypoint would be a good idea. |
Beta Was this translation helpful? Give feedback.
-
Thank You. |
Beta Was this translation helpful? Give feedback.
Hi Rachit, I'll answer all three in case someone runs into this.
You should configure
client_library
to use@js-from-routes/axios
instead:Make sure to regenerate the helpers after making this change.
You can modify the configuration by importing
AxiosConfig
:Read this section in the docs.
It's usually convenien…