Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
Fixed custom endpoint action types
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielleHuisman committed Aug 13, 2016
1 parent 79d9f0b commit 4193a0c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "redux-cached-api",
"description": "Redux middleware for calling and caching a (REST) API",
"version": "1.1.9",
"version": "1.1.11",
"license": "MIT",
"author": "Vereniging Campus Kabel <info@vck.tv> (https://vck.tv)",
"contributors": [
Expand Down
5 changes: 4 additions & 1 deletion src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ export const createApi = (config) => {
endpoint.actionTypes = {};
const actionType = camelCaseToUpperUnderscore(endpointName);
for (const state of ACTION_STATES) {
endpoint.actionTypes[state] = actionType + '_' + state;
const symbol = Symbol(api.name + '_' + actionType + '_' + state);
endpoint.actionTypes[state] = symbol;
api.actionTypes.all[actionType + '_' + state] = symbol;
api.actionTypes[state.toLowerCase()].push(symbol);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const createApiActionTypes = (...apis) => {
if (typeof api !== 'object') {
throw new InvalidConfigError('Invalid API configuration: ' + api);
}
for (const [typeName, type] of Object.entries(api.actionTypes)) {
for (const [typeName, type] of Object.entries(api.actionTypes.all)) {
types[(appendName ? api.name + '_' : '') + typeName] = type;
}
}
Expand Down

0 comments on commit 4193a0c

Please sign in to comment.