I created a axios client
const backendClient = axios.create({
baseURL: window['getConfig']?.url?.backend,
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
timeout: window['getConfig']?.timeout || 30000,
});
and I make the every calls with that client in my application. but I want to remove timeout for just one specific call. Is there a way to do it ? U can see my fetch below.
const loadMessageDetail = () => {
backendClient.get(getDashboardDataQuery())
.then((response) => {
......
}).catch(() => {
......
});
}
>Solution :
This can be done simply by overriding the global timeout setting in the configuration of that specific request. Something like:
const loadMessageDetail = () => {
backendClient.get(getDashboardDataQuery(), { timeout: 0 }) // <----Notice this config object
.then((response) => {
//...
}).catch(() => {
//...
});
}