-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (39 loc) · 1.56 KB
/
index.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
var choo = require('choo')
var middleware = require('./lib/prismic-middleware')
var REPOSITORY = 'https://unga-klara.cdn.prismic.io/api/v2'
var app = choo({ hash: false })
if (process.env.NODE_ENV === 'development') {
app.use(require('choo-devtools')())
app.use(require('choo-service-worker/clear')())
}
app.use(require('./stores/reset'))
app.use(require('./stores/ui'))
app.use(require('./stores/favicon'))
app.use(require('./stores/tracking'))
app.use(require('./stores/navigation'))
app.use(require('./stores/prismic')({ repository: REPOSITORY, middleware }))
app.use(require('choo-meta')({ origin: app.state.origin }))
app.use(require('choo-service-worker')('/sw.js'))
/**
* 1. Clumpsy workaround for supporting wildcard parent path
* 2. Discard parent slug by letting tail override the `slug` param
*/
app.route('/', require('./views/home'))
app.route('/scen', require('./views/events'))
app.route('/scen/:slug', require('./views/event'))
app.route('/pedagoger', require('./views/teachers'))
app.route('/pedagoger/:slug', require('./views/page')) /* 1 */
app.route('/besoket', require('./views/visit'))
app.route('/besoket/:slug', require('./views/visit')) /* 1 */
app.route('/:slug/:slug', require('./views/page')) /* 2 */
app.route('/:slug', require('./views/page'))
try {
module.exports = app.mount('body')
// remove parse guard added in header
window.onerror = null
} catch (err) {
if (typeof window !== 'undefined') {
document.documentElement.removeAttribute('scripting-enabled')
document.documentElement.setAttribute('scripting-initial-only', '')
}
}