next-persist
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "next-persist", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Bridging the gap between client-side persistence and server-side rendering", | ||
@@ -5,0 +5,0 @@ "main": "src/next-persist.js", |
@@ -24,3 +24,2 @@ const nextPersist = {}; | ||
nextPersist.getStorage = (key, state) => { | ||
if (typeof window !== 'undefined') { | ||
@@ -27,0 +26,0 @@ const clientState = localStorage.getItem(key); |
@@ -1,25 +0,28 @@ | ||
import React, { Component } from 'react'; | ||
import { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { writeStorage } from "next-persist"; | ||
import { writeStorage } from './next-persist'; | ||
const mapStateToProps = (state) => ({ | ||
state: state, | ||
state, | ||
}); | ||
class NextPersistWrapper extends Component { | ||
constructor(props) { | ||
super(props) | ||
}; | ||
render() { | ||
if (this.props.wrapperConfig.combinedReducers) { | ||
const { allowedKeys } = this.props.wrapperConfig; | ||
const { allowedReducers } = this.props.wrapperConfig; | ||
const allowedKeys = this.props.wrapperConfig.allowedKeys; | ||
const allowedReducers = this.props.wrapperConfig.allowedReducers; | ||
allowedReducers.forEach((allowedReducer, index) => { | ||
allowedReducers.forEach((allowedReducer, index) => { | ||
const nextPersistConfig = { | ||
key: allowedKeys[index], | ||
}; | ||
writeStorage(nextPersistConfig, this.props.state[allowedReducer]); | ||
}); | ||
} else { | ||
const nextPersistConfig = { | ||
key: allowedKeys[index], | ||
} | ||
writeStorage(nextPersistConfig, this.props.state[allowedReducer]); | ||
}) | ||
key: this.props.wrapperConfig.key, | ||
allowList: this.props.wrapperConfig.allowList, | ||
}; | ||
writeStorage(nextPersistConfig, this.props.state); | ||
} | ||
@@ -26,0 +29,0 @@ return this.props.children; |
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
6421
126