react-isomorphic-tools
Advanced tools
Comparing version 2.4.1 to 2.4.2
@@ -11,2 +11,3 @@ 'use strict'; | ||
var FETCH_TO_STATE_FAIL = exports.FETCH_TO_STATE_FAIL = '@@fetchToState/fail'; | ||
var FETCH_TO_STATE_CLEAR = exports.FETCH_TO_STATE_CLEAR = '@@fetchToState/clear'; | ||
@@ -13,0 +14,0 @@ //Preload |
{ | ||
"name": "react-isomorphic-tools", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "Authorization, Fetcher, Preload. Tools for ServerSide rendering", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -12,5 +12,5 @@ 'use strict'; | ||
var _extends5 = require('babel-runtime/helpers/extends'); | ||
var _extends6 = require('babel-runtime/helpers/extends'); | ||
var _extends6 = _interopRequireDefault(_extends5); | ||
var _extends7 = _interopRequireDefault(_extends6); | ||
@@ -27,3 +27,3 @@ var _constants = require('../constants'); | ||
case _constants.FETCH_TO_STATE_REQUEST: | ||
return (0, _extends6.default)({}, state, (0, _defineProperty3.default)({}, action.meta.key, (0, _extends6.default)({}, state[action.meta.key], { | ||
return (0, _extends7.default)({}, state, (0, _defineProperty3.default)({}, action.meta.key, (0, _extends7.default)({}, state[action.meta.key], { | ||
_request: action.payload.request, | ||
@@ -35,3 +35,3 @@ isFetching: true, | ||
case _constants.FETCH_TO_STATE_SUCCESS: | ||
return (0, _extends6.default)({}, state, (0, _defineProperty3.default)({}, action.meta.key, (0, _extends6.default)({}, action.payload, { | ||
return (0, _extends7.default)({}, state, (0, _defineProperty3.default)({}, action.meta.key, (0, _extends7.default)({}, action.payload, { | ||
isFetched: true, | ||
@@ -42,3 +42,3 @@ isFetching: false, | ||
case _constants.FETCH_TO_STATE_FAIL: | ||
return (0, _extends6.default)({}, state, (0, _defineProperty3.default)({}, action.meta.key, (0, _extends6.default)({}, state[action.meta.key], { | ||
return (0, _extends7.default)({}, state, (0, _defineProperty3.default)({}, action.meta.key, (0, _extends7.default)({}, state[action.meta.key], { | ||
error: action.payload.error, | ||
@@ -48,2 +48,17 @@ isFetching: false, | ||
}))); | ||
case _constants.FETCH_TO_STATE_CLEAR: | ||
{ | ||
var meta = action.meta; | ||
if (Array.isArray(meta)) { | ||
return (0, _extends7.default)({}, state, meta.reduce(function (acc, cur) { | ||
acc[cur] = undefined; | ||
return acc; | ||
}, {})); | ||
} else { | ||
return (0, _extends7.default)({}, state, (0, _defineProperty3.default)({}, meta, undefined)); | ||
} | ||
} | ||
default: | ||
@@ -50,0 +65,0 @@ return state; |
@@ -6,2 +6,3 @@ //Fetcher | ||
export const FETCH_TO_STATE_FAIL = '@@fetchToState/fail' | ||
export const FETCH_TO_STATE_CLEAR = '@@fetchToState/clear' | ||
@@ -8,0 +9,0 @@ //Preload |
@@ -1,2 +0,2 @@ | ||
import {FETCH_TO_STATE_REQUEST, FETCH_TO_STATE_SUCCESS, FETCH_TO_STATE_FAIL} from '../constants' | ||
import {FETCH_TO_STATE_REQUEST, FETCH_TO_STATE_SUCCESS, FETCH_TO_STATE_FAIL, FETCH_TO_STATE_CLEAR} from '../constants' | ||
@@ -33,2 +33,17 @@ const fetchData = (state = {}, action) => { | ||
} | ||
case FETCH_TO_STATE_CLEAR: { | ||
const {meta} = action | ||
if (Array.isArray(meta)) { | ||
return { | ||
...state, ...meta.reduce((acc, cur) => { | ||
acc[cur] = undefined; | ||
return acc; | ||
}, {}) | ||
} | ||
} else { | ||
return {...state, [meta]: undefined} | ||
} | ||
} | ||
default: | ||
@@ -35,0 +50,0 @@ return state |
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
251066
2856