-
Notifications
You must be signed in to change notification settings - Fork 18
/
app.js
37 lines (32 loc) · 1.18 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
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
import React from 'react';
import FluxibleApp from 'fluxible';
import fetchrPlugin from 'fluxible-plugin-fetchr';
import routrPlugin from 'fluxible-plugin-routr';
import routes from './configs/routes';
import show500 from './actions/show500';
import show404 from './actions/show404';
const app = new FluxibleApp({
component: React.createFactory(require('./components/Application.jsx')),
componentActionHandler: function (context, payload, done) {
if (payload.err) {
if (payload.err.statusCode && payload.err.statusCode === 404) {
context.executeAction(show404, payload, done);
}
else {
console.log(payload.err.stack || payload.err);
context.executeAction(show500, payload, done);
}
return;
}
done();
}
});
app.plug(fetchrPlugin({ xhrPath: '/_api' }));
app.plug(routrPlugin({ routes: routes }));
app.registerStore(require('./stores/DocStore'));
app.registerStore(require('./stores/ApplicationStore'));
export default app;