diff options
author | Dan <danjm.com@gmail.com> | 2018-04-10 17:49:01 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-04-10 17:49:01 +0800 |
commit | f4d8da927734b2dcd597d1cc833f9fe6ac59cc77 (patch) | |
tree | 24984f09e1a0a86b8187ffee5197e3857a2b10cc /development/mock-dev.js | |
parent | 284dd85a99f538b77fd477f4952117d1792f64a5 (diff) | |
parent | 29dab1e9e00c1c1e6ad834026df51b2839d3171d (diff) | |
download | tangerine-wallet-browser-f4d8da927734b2dcd597d1cc833f9fe6ac59cc77.tar.gz tangerine-wallet-browser-f4d8da927734b2dcd597d1cc833f9fe6ac59cc77.tar.zst tangerine-wallet-browser-f4d8da927734b2dcd597d1cc833f9fe6ac59cc77.zip |
Merge branch 'master' into i3725-refactor-send-component
Diffstat (limited to 'development/mock-dev.js')
-rw-r--r-- | development/mock-dev.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/development/mock-dev.js b/development/mock-dev.js index a1fb3a86d..f332633d5 100644 --- a/development/mock-dev.js +++ b/development/mock-dev.js @@ -36,15 +36,28 @@ log.setLevel('debug') // const qs = require('qs') -let queryString = qs.parse(window.location.href.split('#')[1]) -let selectedView = queryString.view || 'first time' +const routerPath = window.location.href.split('#')[1] +let queryString = {} +let selectedView + +if (routerPath) { + queryString = qs.parse(routerPath.split('?')[1]) +} + +selectedView = queryString.view || 'first time' const firstState = states[selectedView] updateQueryParams(selectedView) -function updateQueryParams(newView) { +function updateQueryParams (newView) { queryString.view = newView const params = qs.stringify(queryString) - window.location.href = window.location.href.split('#')[0] + `#${params}` + const locationPaths = window.location.href.split('#') + const routerPath = locationPaths[1] || '' + const newPath = locationPaths[0] + '#' + routerPath.split('?')[0] + `?${params}` + + if (window.location.href !== newPath) { + window.location.href = newPath + } } // |