Skip to content

Commit

Permalink
Merge pull request #3774 from reza-sadeghzadeh/add-headers-to-axios-q…
Browse files Browse the repository at this point in the history
…uery
  • Loading branch information
markerikson authored Oct 3, 2023
2 parents c5067bf + 55bb510 commit ad8d983
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 ad8d983

Please sign in to comment.