Fix hidden photo page type
This commit is contained in:
parent
c0f4f1fbf1
commit
ac3b71142e
@ -5,7 +5,7 @@ import { PATH_ROOT, absolutePathForPhoto } from '@/site/paths';
|
|||||||
import { TAG_HIDDEN } from '@/tag';
|
import { TAG_HIDDEN } from '@/tag';
|
||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
import { redirect } from 'next/navigation';
|
import { redirect } from 'next/navigation';
|
||||||
import { ReactNode, cache } from 'react';
|
import { cache } from 'react';
|
||||||
|
|
||||||
const getPhotoCachedCached = cache(getPhotoCached);
|
const getPhotoCachedCached = cache(getPhotoCached);
|
||||||
|
|
||||||
@ -40,10 +40,9 @@ export async function generateMetadata({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function PhotoTagPage({
|
export default async function PhotoTagHiddenPage({
|
||||||
params: { photoId },
|
params: { photoId },
|
||||||
children,
|
}: PhotoTagProps) {
|
||||||
}: PhotoTagProps & { children: ReactNode }) {
|
|
||||||
const photo = await getPhotoCachedCached(photoId, true);
|
const photo = await getPhotoCachedCached(photoId, true);
|
||||||
|
|
||||||
if (!photo) { redirect(PATH_ROOT); }
|
if (!photo) { redirect(PATH_ROOT); }
|
||||||
@ -51,8 +50,7 @@ export default async function PhotoTagPage({
|
|||||||
const photos = await getPhotosCached({ hidden: 'only' });
|
const photos = await getPhotosCached({ hidden: 'only' });
|
||||||
const count = photos.length;
|
const count = photos.length;
|
||||||
|
|
||||||
return <>
|
return (
|
||||||
{children}
|
|
||||||
<PhotoDetailPage {...{ photo, photos, count, tag: TAG_HIDDEN }} />
|
<PhotoDetailPage {...{ photo, photos, count, tag: TAG_HIDDEN }} />
|
||||||
</>;
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user