Make /about/edit safely pre-render
This commit is contained in:
parent
915b19bb54
commit
bd2dd6a030
@ -24,7 +24,8 @@ export default async function AboutEditPage() {
|
|||||||
photosCount,
|
photosCount,
|
||||||
photosHidden,
|
photosHidden,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
getAbout().then(async about => {
|
getAbout()
|
||||||
|
.then(async about => {
|
||||||
const photoAvatar = about?.photoIdAvatar
|
const photoAvatar = about?.photoIdAvatar
|
||||||
? await getPhoto(about?.photoIdAvatar ?? '', true)
|
? await getPhoto(about?.photoIdAvatar ?? '', true)
|
||||||
.catch(() => undefined)
|
.catch(() => undefined)
|
||||||
@ -40,7 +41,12 @@ export default async function AboutEditPage() {
|
|||||||
photoAvatar,
|
photoAvatar,
|
||||||
photoHero,
|
photoHero,
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
|
.catch(() => ({
|
||||||
|
about: undefined,
|
||||||
|
photoAvatar: undefined,
|
||||||
|
photoHero: undefined,
|
||||||
|
})),
|
||||||
getPhotosCached(PHOTO_CHOOSER_QUERY_OPTIONS)
|
getPhotosCached(PHOTO_CHOOSER_QUERY_OPTIONS)
|
||||||
.catch(() => []),
|
.catch(() => []),
|
||||||
getPhotosMetaCached(PHOTO_CHOOSER_QUERY_OPTIONS)
|
getPhotosMetaCached(PHOTO_CHOOSER_QUERY_OPTIONS)
|
||||||
|
|||||||
@ -67,7 +67,7 @@ export default function AdminAboutEditPage({
|
|||||||
label="Avatar Photo"
|
label="Avatar Photo"
|
||||||
value={aboutForm?.photoIdAvatar ?? ''}
|
value={aboutForm?.photoIdAvatar ?? ''}
|
||||||
onChange={photoIdAvatar => setAboutForm(form =>
|
onChange={photoIdAvatar => setAboutForm(form =>
|
||||||
({ ...form, photoIdAvatar: convertUrlToPhotoId(photoIdAvatar) }))}
|
({ ...form, photoIdAvatar }))}
|
||||||
photo={photoAvatar}
|
photo={photoAvatar}
|
||||||
photos={photos}
|
photos={photos}
|
||||||
photosCount={photosCount}
|
photosCount={photosCount}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user