Skip to content

Commit e617171

Browse files
Chantouch SekChantouch Sek
authored andcommitted
chore: ⚡ updated readme
1 parent aa47b9b commit e617171

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,38 @@ Method | Description
261261
**removeParameters([key1, key2])** | Remove params by keys
262262
**removeParameters()** | Remove all params
263263

264+
#### setParameters()
265+
266+
Set parameters with key/value.
267+
268+
**Note**: If you to pass query string as object that can be response like object format at api side.
269+
270+
#### Example
271+
272+
```js
273+
const proxy = new ExampleProxy()
274+
const parameters = {
275+
search: {
276+
first_name: 'Sek',
277+
last_name: 'Chantouch'
278+
},
279+
page: {
280+
limit: 20,
281+
offset: 1
282+
},
283+
order: {
284+
first_name: 'ASC',
285+
last_name: 'DESC'
286+
},
287+
category_id: 6
288+
}
289+
const { data } = proxy.setParameters(parameters).all()
290+
this.data = data
291+
```
292+
**Note**: Query object above will transform into query string like:
293+
294+
``https://my-web-url.com?search[first_name]=Sek&search[last_name]=Chantouch&page[limit]=10&page[offset]=1&order[first_name]=asc&order[last_name]=desc&category_id=6``
295+
264296
if setParameter that value is empty or null it will remove that param for query string
265297

266298
Be sure to use only once in `mounted()` or `asyncData()` and `asyncData()` is only available in `NuxtJs`

0 commit comments

Comments
 (0)