forked from annawchou/fluxible.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
42 lines (34 loc) · 1.13 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
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
import debugLib from 'debug';
import Fluxible from 'fluxible';
import fetchrPlugin from 'fluxible-plugin-fetchr';
import routes from './configs/routes';
import Application from './components/Application.jsx';
import DocStore from './stores/DocStore';
import SearchStore from './stores/SearchStore';
import { RouteStore } from 'fluxible-router';
const debug = debugLib('app.js');
const MyRouteStore = RouteStore.withStaticRoutes(routes);
const app = new Fluxible({
component: Application,
componentActionHandler: function (context, payload, done) {
if (payload.err) {
if (payload.err.statusCode === 404) {
debug('component 404 error', payload.err);
}
else {
debug('component exception', payload.err);
}
return;
}
done();
}
});
app.plug(fetchrPlugin({ xhrPath: '/_api' }));
app.registerStore(DocStore);
app.registerStore(MyRouteStore);
app.registerStore(SearchStore);
export default app;