Skip to content

Commit

Permalink
docs(rtk-query): add headers argument to base query example using axios
Browse files Browse the repository at this point in the history
  • Loading branch information
reza-sadeghzadeh committed Oct 3, 2023
1 parent c5067bf commit 55bb510
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/rtk-query/usage/customizing-queries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,17 @@ const axiosBaseQuery =
method: AxiosRequestConfig['method']
data?: AxiosRequestConfig['data']
params?: AxiosRequestConfig['params']
headers?: AxiosRequestConfig['headers']
},
unknown,
unknown
> =>
async ({ url, method, data, params }) => {
async ({ url, method, data, params, headers }) => {
try {
const result = await axios({ url: baseUrl + url, method, data, params })
const result = await axios({ url: baseUrl + url, method, data, params, headers })
return { data: result.data }
} catch (axiosError) {
let err = axiosError as AxiosError
const err = axiosError as AxiosError
return {
error: {
status: err.response?.status,
Expand Down

0 comments on commit 55bb510

Please sign in to comment.