-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigureStore.js
81 lines (74 loc) · 1.44 KB
/
configureStore.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { createStore, applyMiddleware } from 'redux'
import initSubscriber from 'redux-subscriber'
import getRootReducer from './reducers'
import screenTracking from './middleware/screenTracking'
import * as Global from './utils/Global'
/*
const init_state = {
ui: {
showDeleteBtn: false,
showEditBtn: false
},
page: {
val: Global.PAGE.DEFAULT.val,
title: Global.PAGE.DEFAULT.title,
show_context_menu: false
},
signal_flags: {
decks_delete_flag: false,
deck_edit_flag: false
},
decks: [{
id: 'abcde',
name: 'Deck 1',
cards: [{
id: 'aaaaa',
index: 1,
question: 'Q1: question',
ans: false
}, {
id: 'aaaab',
index: 2,
question: 'Q2: question',
ans: false
}, {
id: 'aaaac',
index: 3,
question: 'Q3: question',
ans: false
}],
// score: 0,
is_selected: false,
// num_cards_ans: 0
}, {
id: 'abcdd',
name: 'Deck 2',
cards: [],
// score: 0,
is_selected: false,
// num_cards_ans: 0
}]
}
*/
const init_state = {
ui: {
showDeleteBtn: false,
showEditBtn: false
},
page: {
val: Global.PAGE.DEFAULT.val,
title: Global.PAGE.DEFAULT.title,
show_context_menu: false
},
signal_flags: {
decks_delete_flag: false,
deck_edit_flag: false
},
decks: []
}
const configureStore = (navReducer) => {
const store = createStore(getRootReducer(navReducer), init_state, applyMiddleware(screenTracking))
const subscribe = initSubscriber(store)
return store
}
export default configureStore