Skip to content

Commit 55bb510

Browse files
docs(rtk-query): add headers argument to base query example using axios
1 parent c5067bf commit 55bb510

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docs/rtk-query/usage/customizing-queries.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,17 @@ const axiosBaseQuery =
369369
method: AxiosRequestConfig['method']
370370
data?: AxiosRequestConfig['data']
371371
params?: AxiosRequestConfig['params']
372+
headers?: AxiosRequestConfig['headers']
372373
},
373374
unknown,
374375
unknown
375376
> =>
376-
async ({ url, method, data, params }) => {
377+
async ({ url, method, data, params, headers }) => {
377378
try {
378-
const result = await axios({ url: baseUrl + url, method, data, params })
379+
const result = await axios({ url: baseUrl + url, method, data, params, headers })
379380
return { data: result.data }
380381
} catch (axiosError) {
381-
let err = axiosError as AxiosError
382+
const err = axiosError as AxiosError
382383
return {
383384
error: {
384385
status: err.response?.status,

0 commit comments

Comments
 (0)