Skip to content

Commit

Permalink
v5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
greena13 committed Oct 9, 2020
1 parent 5f066ff commit 344d28d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-and-the-rest",
"version": "5.0.0",
"version": "5.1.0",
"description": "Declarative, flexible Redux integration with your RESTful API",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/RESTful/fetchItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ function actionCreator(options, paramsOrActionCreatorOptions, optionalActionCrea
};
}

function localActionCreator(options, paramsOrActionCreatorOptions, optionalActionCreatorOptions) {
throw 'fetchItem is not supported with the localOnly option. User getOrFetchItem instead.';
function localActionCreator() {
throw new Error('fetchItem is not supported with the localOnly option. User getOrFetchItem instead.');
}

/** ************************************************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions src/actions/RESTful/fetchList.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ function actionCreator(options, params, actionCreatorOptions = {}) {
};
}

function localActionCreator(options, paramsOrActionCreatorOptions, optionalActionCreatorOptions) {
throw 'fetchList is not supported with the localOnly option. User getOrFetchList instead.';
function localActionCreator() {
throw new Error('fetchList is not supported with the localOnly option. User getOrFetchList instead.');
}

/** ************************************************************************************************************
Expand Down
8 changes: 2 additions & 6 deletions src/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,21 +279,17 @@ function resources(resourceOptions, actionOptions = {}) {
}

if (hasKey(actions, 'newItem')) {
resourceDefinition.getOrInitializeNewItem = (resourcesState, paramsOrValues, valuesOrActionCreatorOptions, optionalActionCreatorOptions) => {
return getOrInitializeNewItem({ action: actions.newItem, newItem: resourceDefinition.newItem }, resourcesState, paramsOrValues, valuesOrActionCreatorOptions, optionalActionCreatorOptions);
};
resourceDefinition.getOrInitializeNewItem = (resourcesState, paramsOrValues, valuesOrActionCreatorOptions, optionalActionCreatorOptions) => getOrInitializeNewItem({ action: actions.newItem, newItem: resourceDefinition.newItem }, resourcesState, paramsOrValues, valuesOrActionCreatorOptions, optionalActionCreatorOptions);
}

if (hasKey(actions, 'createItem') && hasKey(actions, 'updateItem')) {
resourceDefinition.saveItem = (resourcesState, paramsOrValues, valuesOrActionCreatorOptions, optionalActionCreatorOptions) => {
return saveItem({
resourceDefinition.saveItem = (resourcesState, paramsOrValues, valuesOrActionCreatorOptions, optionalActionCreatorOptions) => saveItem({
createItem: resourceDefinition.createItem,
updateItem: resourceDefinition.updateItem,

// Resource options required by handler
keyBy, singular
}, resourcesState, paramsOrValues, valuesOrActionCreatorOptions, optionalActionCreatorOptions);
};
}

if (hasKey(actions, 'fetchList')) {
Expand Down

0 comments on commit 344d28d

Please sign in to comment.