diff --git a/frontend/src/index.js b/frontend/src/index.js index 4dd9b371..eb34d78c 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -1,12 +1,12 @@ import { IntlProvider } from 'react-intl-redux'; import { BrowserRouter } from 'react-router-dom'; import { Provider } from 'react-redux'; +import qs from 'querystring'; import a11y from 'react-a11y'; import ReactDOM from 'react-dom'; import React from 'react'; import App from '@containers/app'; -// import MockState from './mock-state.json'; import MockStateTesting from './mock-state-testing.json'; import MockState from './mock-state.json'; import LeakDatasets from './dataset-leak.json'; @@ -19,9 +19,11 @@ if (process.env.NODE_ENV !== 'production') { }); } -// TODO want ot be able to switch whic mock state to use -// based on a query string -const mockState = MockStateTesting; +const query = qs.parse(window.location.search.replace(/^\?/, '')); +const mockState = query.mock !== 'all' + ? MockStateTesting + : MockState; + // node_memory_rss_bytes // node_memory_heap_total_bytes // node_memory_heap_used_bytes diff --git a/package.json b/package.json index 9ed8b9f9..bdade50d 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "husky": "^0.13.1", "license-to-fail": "^2.2.0", "lodash.findindex": "^4.6.0", + "querystring": "^0.2.0", "style-loader": "^0.13.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 14e16c7f..0de89135 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,7 +1,5 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 - - abbrev@1: version "1.0.9" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" @@ -178,7 +176,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@~2.0.1: +inherits@~2.0.1, inherits@2: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" @@ -308,6 +306,10 @@ process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +querystring: + version "0.2.0" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + read-installed@~4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/read-installed/-/read-installed-4.0.3.tgz#ff9b8b67f187d1e4c29b9feb31f6b223acd19067" @@ -468,3 +470,4 @@ xmlbuilder@~4.1.0: xtend@~4.0.0, xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" +