-
Notifications
You must be signed in to change notification settings - Fork 26k
/
article.js
33 lines (27 loc) · 883 Bytes
/
article.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
import withESI from 'react-esi'
import React from 'react'
import Link from 'next/link'
import BreakingNews from '../components/BreakingNews'
import TopArticles from '../components/TopArticles'
import Weather from '../components/Weather'
const BreakingNewsESI = withESI(BreakingNews, 'BreakingNews')
const TopArticlesESI = withESI(TopArticles, 'TopArticles')
const WeatherESI = withESI(Weather, 'Weather')
const Article = () => (
<div>
<h1>An article</h1>
<main>This a specific article of the website!</main>
{/* TODO: introduce a layout */}
<TopArticlesESI from="the article page" />
<BreakingNewsESI />
<WeatherESI />
<Link href="/">
<a>Go back to the homepage</a>
</Link>
</div>
)
Article.getInitialProps = async function({ res }) {
if (res) res.set('Cache-Control', 's-maxage: 10, maxage: 0')
return {}
}
export default Article