crudSaga
crudSaga(options, extend) ⇒ function
function
This helper implements an entire REST sagas flow based on minimal configuration. As long as your endpoint follows standard REST, this helper can establish a basic starting point for CRUD functionality. It is extensible, and its defaults can be overwritten. The only requirements are a name and a sagaApi
.
Returns: function
- Function that accepts redux actions object
Param | Type | Required | Description |
options |
| Yes | Options to pass to saga helper |
options.name |
| Yes | REST resource name |
options.sagaApi |
| Yes | A |
extend |
| No | A function to pass actions and add extra sagas |
Simple Example:
Extended Example:
REST implementation
crudSaga will implement the following based on name: 'todos'
:
Action Type | Method | Path | Success | Fail | Done |
readAll | GET |
| readAllSuccess | readAllFail | readAllDone |
readOne | GET |
| readOneSuccess | readOneFail | readOneDone |
create | POST |
| createSuccess | createFail | createDone |
update | PUT |
| updateSuccess | updateFail | updateDone |
patch | PATCH |
| patchSuccess | patchFail | patchDone |
delete | DELETE |
| deleteSuccess | deleteFail | deleteDone |
Last updated