|
@@ -3,9 +3,11 @@ import { createLogger } from 'redux-logger'
|
3
|
3
|
import * as persist from 'redux-persist'
|
4
|
4
|
import reducer from '../reducers'
|
5
|
5
|
import storage from 'redux-persist/lib/storage'
|
6
|
|
-
|
7
|
6
|
import thunkMiddleware from 'redux-thunk'
|
8
|
7
|
|
|
8
|
+// 扩展参数, 可在异步action中获取到
|
|
9
|
+const extraArgs = 'somethings...'
|
|
10
|
+
|
9
|
11
|
const loggerMiddleware = createLogger({
|
10
|
12
|
colors: {
|
11
|
13
|
action: () => '#03A9F4',
|
|
@@ -22,6 +24,6 @@ const persistConfig = {
|
22
|
24
|
storage,
|
23
|
25
|
}
|
24
|
26
|
const persistedReducer = persistReducer(persistConfig, reducer)
|
25
|
|
-export const store = createStore(persistedReducer, applyMiddleware(thunkMiddleware, loggerMiddleware))
|
|
27
|
+export const store = createStore(persistedReducer, applyMiddleware(thunkMiddleware.withExtraArgument(extraArgs), loggerMiddleware))
|
26
|
28
|
export const persistor = persistStore(store)
|
27
|
29
|
|