How implement AxiosAuthRefreshRequestConfig type
See original GitHub issueI have this instance
export const aInstance = axios.create({
baseURL: API_URL,
headers: { 'Content-type': 'application/json' },
})
and use with your config:
createAuthRefreshInterceptor(aInstance, refreshAuthLogic, { statusCodes: [401, 403] })
But if i want add the flag to skip refresh token with Typescript, for example
export const login = (data: LoginDataType): Promise<AxiosResponse> => {
const url = '/auth/login'
return aInstance.post(url, data, { skipAuthRefresh: true })
}
On { skipAuthRefresh: true } TypeScript said:
Argument of type '{ skipAuthRefresh: boolean; }' is not assignable to parameter of type 'AxiosRequestConfig'.
Object literal may only specify known properties, and 'skipAuthRefresh' does not exist in type 'AxiosRequestConfig'
It can fix with your AxiosAuthRefreshRequestConfig, but how can i implement it?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Multiple requests,about Flyrell/axios-auth-refresh - GithubHelp
Please, use StackOverflow for implementation questions. ... Specify a different type HOT 1; How implement AxiosAuthRefreshRequestConfig type HOT 6 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Unfortunately, the only way is to cast it with
as
.Hah, that’s something new. I think it might be the set up on your side, as it work just fine at my end, but try wrapping it up in
()
or using the other casting syntax…