getInitialProps request stability improvements
This commit is contained in:
1 parent
95c8369df2
commit
7ab68f5a8e
13 files changed
+65
-55
No files matched your search
@@ -7,7 +7,7 @@ import { Meta } from '../../src/components/Meta'
|
||||
import menuModel from '../../src/models/menu'
|
||||
import { buildMenu } from '../../src/lib/menu'
|
||||
import { meta } from '../../src/lib/meta'
|
||||
import { createApiUrl } from '../../src/next-lib'
|
||||
import { createApiUrl, requestGet } from '../../src/next-lib'
|
||||
|
||||
const Index = (props) => (
|
||||
<App
|
||||
@@ -30,11 +30,10 @@ const Index = (props) => (
|
||||
Index.getInitialProps = async (ctx) => {
|
||||
const pageUrl = '/collective'
|
||||
const id = ctx.query.person
|
||||
const res = await axios.get(createApiUrl(ctx.req, `/api/persons/${id}`))
|
||||
const person = res.data
|
||||
const person = await requestGet(createApiUrl(ctx.req, `/api/persons/${id}`), {})
|
||||
const name = person.name || []
|
||||
const title = name.join(' ')
|
||||
const image = person.preview.artifacts.fb
|
||||
const image = person.preview ? person.preview.artifacts.fb : {}
|
||||
|
||||
return {
|
||||
pageUrl,
|
||||
|
||||
Reference in new issue
Block a user