redux-supermodel
Advanced tools
Comparing version 0.18.0 to 0.18.1
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _handlers; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
@@ -116,2 +118,4 @@ | ||
var handlers = (_handlers = {}, _defineProperty(_handlers, types.RESET, reset), _defineProperty(_handlers, types.PENDING, pending), _defineProperty(_handlers, types.FULFILLED, fulfilled), _defineProperty(_handlers, types.REJECTED, rejected), _defineProperty(_handlers, types.CLEAR_ERRORS, clearErrors), _handlers); | ||
function reducer() { | ||
@@ -129,16 +133,7 @@ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
switch (type) { | ||
case types.RESET: | ||
return reset(state, action); | ||
case types.PENDING: | ||
return pending(state, action); | ||
case types.FULFILLED: | ||
return fulfilled(state, action); | ||
case types.REJECTED: | ||
return rejected(state, action); | ||
case types.CLEAR_ERRORS: | ||
return clearErrors(state, action); | ||
default: | ||
throw new Error('Unrecognized action type: ' + type); | ||
if (handlers[type]) { | ||
return handlers[type](state, action); | ||
} else { | ||
throw new Error('Unrecognized action type: ' + type); | ||
} | ||
} |
{ | ||
"name": "redux-supermodel", | ||
"version": "0.18.0", | ||
"version": "0.18.1", | ||
"description": "A package of action creator functions and reducers that deal with the state management of REST-like APIs for you... all you need is a URL!", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/MrLeebo/redux-supermodel", |
@@ -52,2 +52,3 @@ # redux-supermodel | ||
export const post = client('post', { url: 'posts/latest' }) | ||
post.fetch() | ||
``` | ||
@@ -79,10 +80,8 @@ | ||
componentWillUnmount() { | ||
// If you only ever access a resource within the context of a single component and | ||
// its children, you can reset the resource on unmount to clean up your redux state. | ||
this.props.resetPost() | ||
} | ||
// If you only ever access a resource within the context of a single component and | ||
// its children, you can reset the resource on unmount to clean up your redux state. | ||
componentWillUnmount = () => this.props.resetPost() | ||
render() { | ||
const { initialized, error, title, body, fetchPost } = props | ||
const { initialized, error, title, body, fetchPost } = this.props | ||
@@ -89,0 +88,0 @@ if (!initialized) { |
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
194699
662
149