-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
41 lines (35 loc) · 1.19 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
import React from "react";
import { Router, Route, browserHistory } from "react-router";
import { createApp, renderApp } from "@phenomic/preset-react-app/lib/client";
import "./styles/global.js";
import Html from "./components/internals/Document/Html";
import { Blog, Homepage, NotFound, Post } from "./components/pages";
const routes = () =>
<Router history={browserHistory}>
<Route path="/" component={Homepage} />
<Route path="/posts" component={Blog} collection="posts" paginated />
<Route
path="/posts/tag/:tag"
component={Blog}
collection="posts"
paginated
/>
<Route
path="/posts/after/:after"
component={Blog}
collection="posts"
paginated
/>
<Route path="/posts/*" component={Post} collection="posts" />
<Route path="*" component={NotFound} />
</Router>;
export default createApp(routes, Html);
if (module.hot) {
module.hot.accept(() => renderApp(routes));
}
// kill previous website ServiceWorker
if (typeof navigator !== "undefined" && "serviceWorker" in navigator) {
navigator.serviceWorker.getRegistrations().then(registrations => {
for (const registration of registrations) registration.unregister();
});
}