Skip to content

Commit cc4c7d3

Browse files
authored
Change name back to arg
1 parent 79acc76 commit cc4c7d3

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

docs/rtk-query/api/fetchBaseQuery.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type FetchBaseQueryArgs = {
6464
api: Pick<
6565
BaseQueryApi,
6666
'getState' | 'extra' | 'endpoint' | 'type' | 'forced'
67-
> & { args: string | FetchArgs },
67+
> & { arg: string | FetchArgs },
6868
) => MaybePromise<Headers | void>
6969
fetchFn?: (
7070
input: RequestInfo,
@@ -114,7 +114,7 @@ type prepareHeaders = (
114114
headers: Headers,
115115
api: {
116116
getState: () => unknown
117-
args: string | FetchArgs
117+
arg: string | FetchArgs
118118
extra: unknown
119119
endpoint: string
120120
type: 'query' | 'mutation'

packages/toolkit/src/query/fetchBaseQuery.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export type FetchBaseQueryArgs = {
112112
api: Pick<
113113
BaseQueryApi,
114114
'getState' | 'extra' | 'endpoint' | 'type' | 'forced'
115-
> & { args: string | FetchArgs },
115+
> & { arg: string | FetchArgs },
116116
) => MaybePromise<Headers | void>
117117
fetchFn?: (
118118
input: RequestInfo,
@@ -164,9 +164,9 @@ export type FetchBaseQueryMeta = { request: Request; response?: Response }
164164
* The base URL for an API service.
165165
* Typically in the format of https://example.com/
166166
*
167-
* @param {(headers: Headers, api: { getState: () => unknown; args: string | FetchArgs; extra: unknown; endpoint: string; type: 'query' | 'mutation'; forced: boolean; }) => Headers} prepareHeaders
167+
* @param {(headers: Headers, api: { getState: () => unknown; arg: string | FetchArgs; extra: unknown; endpoint: string; type: 'query' | 'mutation'; forced: boolean; }) => Headers} prepareHeaders
168168
* An optional function that can be used to inject headers on requests.
169-
* Provides a Headers object, most of the `BaseQueryApi` (`dispatch` is not available), and the args passed into the query function.
169+
* Provides a Headers object, most of the `BaseQueryApi` (`dispatch` is not available), and the arg passed into the query function.
170170
* Useful for setting authentication or headers that need to be set conditionally.
171171
*
172172
* @link https://developer.mozilla.org/en-US/docs/Web/API/Headers
@@ -212,7 +212,7 @@ export function fetchBaseQuery({
212212
'Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.',
213213
)
214214
}
215-
return async (args, api) => {
215+
return async (arg, api) => {
216216
const { getState, extra, endpoint, forced, type } = api
217217
let meta: FetchBaseQueryMeta | undefined
218218
let {
@@ -223,7 +223,7 @@ export function fetchBaseQuery({
223223
validateStatus = globalValidateStatus ?? defaultValidateStatus,
224224
timeout = defaultTimeout,
225225
...rest
226-
} = typeof args == 'string' ? { url: args } : args
226+
} = typeof arg == 'string' ? { url: arg } : arg
227227

228228
let abortController: AbortController | undefined,
229229
signal = api.signal
@@ -243,7 +243,7 @@ export function fetchBaseQuery({
243243
config.headers =
244244
(await prepareHeaders(headers, {
245245
getState,
246-
args,
246+
arg,
247247
extra,
248248
endpoint,
249249
forced,

packages/toolkit/src/query/tests/fetchBaseQuery.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,17 +799,17 @@ describe('fetchBaseQuery', () => {
799799
})
800800

801801
test('prepareHeaders provides extra api information for getState, extra, endpoint, type and forced', async () => {
802-
let _getState, _args: any, _extra, _endpoint, _type, _forced
802+
let _getState, _arg: any, _extra, _endpoint, _type, _forced
803803

804804
const baseQuery = fetchBaseQuery({
805805
baseUrl,
806806
fetchFn: fetchFn as any,
807807
prepareHeaders: (
808808
headers,
809-
{ getState, args, extra, endpoint, type, forced },
809+
{ getState, arg, extra, endpoint, type, forced },
810810
) => {
811811
_getState = getState
812-
_args = args
812+
_arg = arg
813813
_endpoint = endpoint
814814
_type = type
815815
_forced = forced
@@ -846,7 +846,7 @@ describe('fetchBaseQuery', () => {
846846
await doRequest()
847847

848848
expect(_getState).toBeDefined()
849-
expect(_args!.url).toBe('/echo')
849+
expect(_arg!.url).toBe('/echo')
850850
expect(_endpoint).toBe('someEndpointName')
851851
expect(_type).toBe('query')
852852
expect(_forced).toBe(true)

0 commit comments

Comments
 (0)