Skip to content

Commit f3f0fa8

Browse files
authored
Merge pull request pagekit#658 from gabrielaraujof/develop
Enhancement on custom actions documentation
2 parents f841d04 + b2f4131 commit f3f0fa8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/resource.md

+23
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,26 @@ delete: {method: 'DELETE'}
6868
});
6969
}
7070
```
71+
72+
**Note:** When passing only one single object (for POST, PUT and PATCH custom actions), it will defaults to body param. If you need set url params you will have to pass an empty object as second argument.
73+
74+
```js
75+
{
76+
var resource = this.$resource('someItem{/id}', {}, {
77+
baz: {method: 'POST', url: 'someItem/baz{/id}'}
78+
});
79+
80+
// POST someItem/baz
81+
resource.baz({id: 1}).then(response => {
82+
// success callback
83+
}, response => {
84+
// error callback
85+
});
86+
87+
// POST someItem/baz/1
88+
resource.baz({id: 1}, {}).then(response => {
89+
// success callback
90+
}, response => {
91+
// error callback
92+
});
93+
```

0 commit comments

Comments
 (0)