aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/redux
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-05-30 06:49:13 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-05-30 06:49:13 +0800
commitbc28a08dd0d4db99549122fb4912b4931a3aad78 (patch)
treeba94822b58608f7c5cf22c0130adb76574de4dd5 /packages/website/ts/redux
parent0d3010f6fc8b14011444f090dfbd0221411a1ab0 (diff)
downloaddexon-0x-contracts-bc28a08dd0d4db99549122fb4912b4931a3aad78.tar.gz
dexon-0x-contracts-bc28a08dd0d4db99549122fb4912b4931a3aad78.tar.zst
dexon-0x-contracts-bc28a08dd0d4db99549122fb4912b4931a3aad78.zip
Address PR feedback
Diffstat (limited to 'packages/website/ts/redux')
-rw-r--r--packages/website/ts/redux/store.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/website/ts/redux/store.ts b/packages/website/ts/redux/store.ts
new file mode 100644
index 000000000..203f068a1
--- /dev/null
+++ b/packages/website/ts/redux/store.ts
@@ -0,0 +1,21 @@
+import * as _ from 'lodash';
+import { createStore, Store as ReduxStore } from 'redux';
+import { devToolsEnhancer } from 'redux-devtools-extension/developmentOnly';
+import { stateStorage } from 'ts/local_storage/state_storage';
+import { reducer, State } from 'ts/redux/reducer';
+
+const ONE_SECOND = 1000;
+
+export const store: ReduxStore<State> = createStore(
+ reducer,
+ stateStorage.getPersistedDefaultState(),
+ devToolsEnhancer({ name: '0x Website Redux Store' }),
+);
+store.subscribe(
+ _.throttle(() => {
+ // Persisted state
+ stateStorage.saveState({
+ hasPortalOnboardingBeenSeen: store.getState().hasPortalOnboardingBeenSeen,
+ });
+ }, ONE_SECOND),
+);