getInitialProps request stability improvements

This commit is contained in:
tmshv committed 2019-10-12 06:21:02 +03:00
1 parent 95c8369df2
commit 7ab68f5a8e
13 files changed
+65 -55

No files matched your search

+2 -4
View File
@@ -1,12 +1,11 @@
import React from 'react'
import axios from 'axios'
import Head from 'next/head'
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'
import { createApiUrl } from '../src/next-lib'
import { createApiUrl, requestGet } from '../src/next-lib'
const Page = (props) => (
<App
@@ -32,8 +31,7 @@ Page.getInitialProps = async (ctx) => {
const pageUrl = ctx.req.url
const period = '2016-2017'
const semester = 'spring'
const res = await axios.get(createApiUrl(ctx.req, `/api/schedule?period=${period}&semester=${semester}`))
const schedule = res.data
const schedule = await requestGet(createApiUrl(ctx.req, `/api/schedule?period=${period}&semester=${semester}`), {})
return {
schedule,