Skip to content

Commit 9258c49

Browse files
update README with example
1 parent 072a2bb commit 9258c49

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,19 @@ const { status, data: pets } = await findPetsByStatus({
6868
console.log(pets[0])
6969
```
7070

71+
If you have a path argument that you also want to appear in the root of the body payload, you can pass an optional third parameter to the created fetch method.
72+
73+
To continue from the example above, it would look something like this:
74+
75+
```ts
76+
// fetch
77+
const { status, data: pets } = await findPetsByStatus({
78+
status: ['available', 'pending'],
79+
undefined,
80+
['keyToParamToBePersistedToBody']
81+
})
82+
```
83+
7184
### Typed Error Handling
7285

7386
A non-ok fetch response throws a generic `ApiError`
@@ -179,4 +192,4 @@ type Ret = FetchReturnType<typeof findPetsByStatus>
179192
type Err = FetchErrorType<typeof findPetsByStatus>
180193
```
181194
182-
Happy fetching! 👍
195+
Happy fetching! 👍

0 commit comments

Comments
 (0)