forked from HSLdevcom/digitransit-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
80 lines (75 loc) · 2.74 KB
/
app.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
import Fluxible from 'fluxible';
import routes from './routes';
import FavouriteLocationStore from './store/FavouriteLocationStore';
import FavouriteRoutesStore from './store/FavouriteRoutesStore';
import FavouriteStopsStore from './store/FavouriteStopsStore';
import MessageStore from './store/MessageStore';
import OldSearchesStore from './store/OldSearchesStore';
import PositionStore from './store/PositionStore';
import OriginStore from './store/OriginStore';
import PreferencesStore from './store/PreferencesStore';
import RealTimeInformationStore from './store/RealTimeInformationStore';
import TimeStore from './store/TimeStore';
import FavouriteCityBikeStationStore from './store/FavouriteCityBikeStationStore';
import MapLayerStore from './store/MapLayerStore';
import GeoJsonStore from './store/GeoJsonStore';
import CanceledLegsBarStore from './store/CanceledLegsBarStore';
import ViaPointsStore from './store/ViaPointsStore';
import UserStore from './store/UserStore';
import FavouriteStore from './store/FavouriteStore';
export default config => {
const app = new Fluxible({
component: routes(config),
});
app.registerStore(FavouriteLocationStore);
app.registerStore(FavouriteRoutesStore);
app.registerStore(FavouriteStopsStore);
app.registerStore(MessageStore);
app.registerStore(OldSearchesStore);
app.registerStore(PositionStore);
app.registerStore(OriginStore);
app.registerStore(PreferencesStore);
app.registerStore(RealTimeInformationStore);
app.registerStore(TimeStore);
app.registerStore(FavouriteCityBikeStationStore);
app.registerStore(MapLayerStore);
app.registerStore(GeoJsonStore);
app.registerStore(CanceledLegsBarStore);
app.registerStore(ViaPointsStore);
app.registerStore(UserStore);
app.registerStore(FavouriteStore);
app.plug({
name: 'extra-context-plugin',
plugContext: options => {
let { headers } = options;
return {
plugComponentContext: componentContext => {
// eslint-disable-next-line no-param-reassign
componentContext.config = config;
// eslint-disable-next-line no-param-reassign
componentContext.headers = headers;
},
plugActionContext: actionContext => {
// eslint-disable-next-line no-param-reassign
actionContext.config = config;
},
plugStoreContext: storeContext => {
// eslint-disable-next-line no-param-reassign
storeContext.config = config;
},
dehydrate() {
return {
headers,
config,
};
},
rehydrate(state) {
({ config, headers } = state); // eslint-disable-line no-param-reassign
},
};
},
dehydrate: () => ({}),
rehydrate: () => {},
});
return app;
};