OSDN Git Service

fixed the create asset string decimals for some occassion.
[bytom/bytom-electron.git] / src / reducers.js
1 import { combineReducers } from 'redux'
2 import { routerReducer as routing} from 'react-router-redux'
3 import form from 'features/form/reducers'
4 import accessControl from 'features/accessControl/reducers'
5 import { reducers as account } from 'features/accounts'
6 import { reducers as app } from 'features/app'
7 import { reducers as asset } from 'features/assets'
8 import { reducers as balance } from 'features/balances'
9 import { reducers as core } from 'features/core'
10 import { reducers as initialization } from 'features/initialization'
11 import { reducers as mockhsm } from 'features/mockhsm'
12 import { reducers as testnet } from 'features/testnet'
13 import { reducers as transaction } from 'features/transactions'
14 import { reducers as transactionFeed } from 'features/transactionFeeds'
15 import { reducers as tutorial } from 'features/tutorial'
16 import { reducers as unspent } from 'features/unspents'
17 import { reducers as peer } from 'features/peers'
18 import { clear as clearStorage } from 'utility/localStorage'
19
20 const makeRootReducer = () => (state, action) => {
21   if (action.type == 'UPDATE_CORE_INFO' &&
22       !action.param.isConfigured) {
23     // const newState = {
24     //   form: state.form,
25     //   routing: state.routing,
26     // }
27     //
28     // if (state.core.blockchainId == (action.param.blockchainId || 0)) {
29     //   newState.core = state.core
30     // }
31     //
32     // state = newState
33   } else if (action.type == 'USER_LOG_OUT') {
34     // TODO: see if we can't move this outside of a reducer..
35
36     // Actions still may fire after the location redirect, so make sure they
37     // fire against blank state, and the local storage listener doesn't
38     // persist state.
39     state = undefined
40
41     // Clear tokens and other state from local storage.
42     clearStorage()
43
44     // Finally, reboot the entire dashboard app via a hard redirect.
45     window.location.href = '/'
46   }
47
48   return combineReducers({
49     accessControl,
50     account,
51     app,
52     asset,
53     balance,
54     core,
55     form,
56     initialization,
57     key: mockhsm,
58     routing,
59     peer,
60     testnet,
61     transaction,
62     transactionFeed,
63     tutorial,
64     unspent,
65   })(state, action)
66 }
67 export default makeRootReducer