Axios helper file with interceptors, how to turn it into a context provider?
I have an Axios helper file I have created to add interceptors to my Axios instance. The problem is I am making a hook call in there:
const { instance } = useMsal();
and after some research, I have learned you cannot do that outside of a functional component. So now I think from digging more into this, the only way is to make a Axios provider and wrap my app in that? Is that the best way? If so, how do I do that?
Here is the code in my Axios file:
Rest of the code is pasted below.UU
Unknown User•125d ago
D
dmikester1•125d ago
Here is the rest of that code from above:
D
dmikester1•125d ago
I did some more digging and found that there is a way to pass data into the axios interceptor when calling e.g.
axios.get(...)
=> https://stackoverflow.com/a/70647045/571723Stack Overflow
Pass parameter/argument to axios interceptor
How do I send custom parameters to the axios interceptor? I am using an interceptor like this:
window.axios.interceptors.request.use(function (config) {
if (PASSED_PARAM == true) {
230KMembers
View on DiscordMore Posts
fooneyp – 12-56 Jan 12I have a node project that converts files so I set up workers to run faster and it does by a lot. Thnightskyjeff – 01-27 Jan 10``` const feed = Readable.from([ 'abc', 'def', 'ghi', 'jkl' ]).pipe(process.stdout);
console.eslachance – 12-53 Jan 7Anyone know how to tell vite to use a custom rendered correctly?hoangvu12 – 20-03 Jan 5Is rust faster than javascript in I/O-intensive work? I have a JS script that doing automating (fetcNext JS Module With wasm File and Module Not Found ErrorI'm trying to run code from an npm library called `opencascade`. I installed it using `npm install osnowberb – 09-35 Jan 2What's better?
`const header = isPhone ? intl.formatMessage({ id: 'testimonials.titleMobile' }) : indmikester1 – 00-53 Jan 1I have an array of numbers that looks like this: `[36, 4, 40, -40]` I want to remove all numbers thalexnoah.dev – 11-30 Dec 30How can I make this code shorter,
```js
if(formData && formData.email && formData.password && formDa