Commit 5fd911a0 authored by Vladimir Kiryakov's avatar Vladimir Kiryakov
Browse files

save state to localstorage

parent 25ab8b86
{
"extends": [
"react-app",
"plugin:react/recommended"
"react-app"
],
"plugins": [
"react"
......
......@@ -3,16 +3,27 @@ import thunk from 'redux-thunk';
import mqtt from './mqtt';
import {routerMiddleware} from 'react-router-redux'
import createHistory from 'history/createBrowserHistory'
import {save} from "redux-localstorage-simple"
import config from '../config';
export const history = createHistory();
const saveToLocalStorage = save({
debounce: 1000,
states: [
'form.mqtt',
'mqtt'
],
namespace: 'deviceops-hello-world-frontend'
});
const middleware = [
thunk,
routerMiddleware(history),
mqtt
mqtt,
saveToLocalStorage
];
const composedEnhancers = compose(
......
import {createStore} from 'redux'
import rootReducer from './reducers/rootReducer'
import middlewares from './middlewares'
import {load} from "redux-localstorage-simple"
const initialState = {};
const initialState = load({
states: [
'form.mqtt',
'mqtt'
],
namespace: 'deviceops-hello-world-frontend'
});
export const configureStore = () => {
return createStore(
......
......@@ -1751,6 +1751,10 @@ cliui@^3.2.0:
strip-ansi "^3.0.1"
wrap-ansi "^2.0.0"
clone-function@>=1.0.1:
version "1.0.6"
resolved "https://registry.yarnpkg.com/clone-function/-/clone-function-1.0.6.tgz#428471937750bca9c48ecbfbc16f6e232f74a03d"
clone-regexp@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/clone-regexp/-/clone-regexp-1.0.1.tgz#051805cd33173375d82118fc0918606da39fd60f"
......@@ -3312,7 +3316,7 @@ fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
fsevents@^1.0.0, fsevents@^1.1.2, fsevents@^1.1.3:
fsevents@^1.0.0, fsevents@^1.1.2:
version "1.1.3"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8"
dependencies:
......@@ -5614,6 +5618,10 @@ object-copy@^0.1.0:
define-property "^0.2.5"
kind-of "^3.0.3"
object-foreach@>=0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/object-foreach/-/object-foreach-0.1.2.tgz#d7421c5b40e3b6a3ef57ac624368d21d8f8d2dec"
object-hash@^1.1.4:
version "1.3.0"
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.0.tgz#76d9ba6ff113cf8efc0d996102851fe6723963e2"
......@@ -5622,6 +5630,13 @@ object-keys@^1.0.8:
version "1.0.11"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
object-merge@2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/object-merge/-/object-merge-2.5.1.tgz#077e8915ce38ea7294788448c5dd339e34df4227"
dependencies:
clone-function ">=1.0.1"
object-foreach ">=0.1.2"
object-visit@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb"
......@@ -6668,50 +6683,6 @@ react-router@^4.2.0:
prop-types "^15.5.4"
warning "^3.0.0"
react-scripts@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-1.1.1.tgz#279d449f7311fed910506987a1ade014027788a8"
dependencies:
autoprefixer "7.1.6"
babel-core "6.26.0"
babel-eslint "7.2.3"
babel-jest "20.0.3"
babel-loader "7.1.2"
babel-preset-react-app "^3.1.1"
babel-runtime "6.26.0"
case-sensitive-paths-webpack-plugin "2.1.1"
chalk "1.1.3"
css-loader "0.28.7"
dotenv "4.0.0"
dotenv-expand "4.2.0"
eslint "4.10.0"
eslint-config-react-app "^2.1.0"
eslint-loader "1.9.0"
eslint-plugin-flowtype "2.39.1"
eslint-plugin-import "2.8.0"
eslint-plugin-jsx-a11y "5.1.1"
eslint-plugin-react "7.4.0"
extract-text-webpack-plugin "3.0.2"
file-loader "1.1.5"
fs-extra "3.0.1"
html-webpack-plugin "2.29.0"
jest "20.0.4"
object-assign "4.1.1"
postcss-flexbugs-fixes "3.2.0"
postcss-loader "2.0.8"
promise "8.0.1"
raf "3.4.0"
react-dev-utils "^5.0.0"
style-loader "0.19.0"
sw-precache-webpack-plugin "0.11.4"
url-loader "0.6.2"
webpack "3.8.1"
webpack-dev-server "2.9.4"
webpack-manifest-plugin "1.3.2"
whatwg-fetch "2.0.3"
optionalDependencies:
fsevents "^1.1.3"
react-sidebar@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/react-sidebar/-/react-sidebar-2.3.2.tgz#ec140bea8a6f5fa3d8ea7a56479665b44cf4f9cf"
......@@ -6891,6 +6862,12 @@ redux-form@^7.3.0:
lodash-es "^4.17.5"
prop-types "^15.6.1"
redux-localstorage-simple@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/redux-localstorage-simple/-/redux-localstorage-simple-2.0.0.tgz#dd5fc755e59d7e784c320616d8c6d741bcc1dfe8"
dependencies:
object-merge "2.5.1"
redux-thunk@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.2.0.tgz#e615a16e16b47a19a515766133d1e3e99b7852e5"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment