app moved to next.js

This commit is contained in:
tmshv committed 2019-08-01 14:44:25 +03:00
1 parent dcca513aea
commit 43af2996bf
48 files changed
+1147 -1027

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import React from 'react'
import axios from 'axios'
import App from '../src/components/App'
import Schedule from '../src/components/Schedule'
import Share from '../src/components/Share'
import menuModel from '../src/models/menu'
import { buildMenu } from '../src/lib/menu'
const Page = (props) => (
<App
menu={buildMenu(props.pageUrl, menuModel)}
showAuthor={true}
menuPadding={true}
>
<div className="content content_wide">
{/*<ScheduleList schedules={schedules}/>*/}
<Schedule {...props.schedule} />
<Share />
</div>
</App>
)
Page.getInitialProps = async (ctx) => {
const pageUrl = ctx.req.url
const period = '2016-2017'
const semester = 'spring'
const apiUrl = `http://localhost:3000/api/schedule?period=${period}&semester=${semester}`
const res = await axios.get(apiUrl)
const schedule = res.data
return {
schedule,
pageUrl,
}
}
export default Page