OSDN Git Service

Show the configure page according to the electron state.
authorZhiting Lin <zlin035@uottawa.ca>
Mon, 26 Mar 2018 07:38:16 +0000 (15:38 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Mon, 26 Mar 2018 07:38:16 +0000 (15:38 +0800)
package.json
src/features/app/components/Container.jsx
src/features/core/reducers.js
src/utility/environment.js

index c2f72a8..c78043c 100644 (file)
@@ -6,7 +6,7 @@
   "scripts": {
     "build:dll": "node ./bin/dependencies.js",
     "postinstall": "npm run build:dll",
-    "electron-dev": "DEV_URL=http://localhost:3000/configuration  electron --inspect=5858 main.js .",
+    "electron-dev": "DEV_URL=http://localhost:3000/index.html  electron --inspect=5858 main.js .",
     "build": "NODE_ENV=production webpack --config webpack/webpack.app.js ",
     "build-electron": "NODE_ENV=production MODE=electron webpack --config webpack/webpack.app.js ",
     "lint": "eslint \"src/**\"",
index 94b846b..1647da2 100644 (file)
@@ -28,7 +28,7 @@ class Container extends React.Component {
 
     if (configured) {
       if (location.pathname === '/' ||
-          location.pathname.indexOf('configuration') >= 0) {
+          location.pathname.indexOf('configuration') >= 0 || location.pathname.includes('index.html')) {
         this.props.showRoot()
       }
     } else {
index 178034e..fac2ef2 100644 (file)
@@ -1,5 +1,5 @@
 import { combineReducers } from 'redux'
-import { testnetUrl } from 'utility/environment'
+import { testnetUrl, mode } from 'utility/environment'
 import moment from 'moment'
 import { DeltaSampler } from 'utility/time'
 
@@ -211,10 +211,14 @@ if(window.remote){
   configuredState = window.remote.getGlobal('fileExist')
 }
 export const configured = (state = configuredState, action) => {
-  if (action.type == 'SET_CONFIGURED') {
+  if( mode === 'electron'){
+    if (action.type == 'SET_CONFIGURED') {
+      return true
+    }
+    return state
+  }else{
     return true
   }
-  return state
 }
 
 const defaultLang = window.navigator.language.startsWith('zh') ? 'zh' : 'en'
index 3f46948..cdd0245 100644 (file)
@@ -27,6 +27,7 @@ export const history = useRouterHistory(createHistory)({
   basename: basename
 })
 
+export const mode = process.env.MODE || 'browser'
 export const pageSize = 25
 export const UTXOpageSize = 4