@galette/core
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -23,2 +23,3 @@ export declare type Action = { | ||
listKeyInState: string; | ||
errorMessageResolver?: (action: Action) => string; | ||
totalItems?: (action: Action) => number; | ||
@@ -30,3 +31,3 @@ }; | ||
loading?: number; | ||
error?: any; | ||
error?: string; | ||
total_items?: number; | ||
@@ -33,0 +34,0 @@ }; |
@@ -17,2 +17,6 @@ "use strict"; | ||
} | ||
var defaultErrorMessageResolver = function (action) { | ||
var messageSource = action.error || action.payload || {}; | ||
return messageSource.message || messageSource.error || 'Something went wrong.'; | ||
}; | ||
exports.reduceItems = function (state, action, options) { | ||
@@ -65,5 +69,6 @@ if (state === void 0) { state = {}; } | ||
if (action.type === options.actions.failed) { | ||
var errorResolver = options.errorMessageResolver ? options.errorMessageResolver : defaultErrorMessageResolver; | ||
return functions_1.updateItem(state, options.listKeyInState, { | ||
loading: false, | ||
error: action.error || action.payload, | ||
error: errorResolver(action), | ||
}); | ||
@@ -70,0 +75,0 @@ } |
{ | ||
"name": "@galette/core", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "npm run build-ts", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
31493
38
0
515