Simplify AdminPhotoMenu types
This commit is contained in:
parent
b5b2eb8f46
commit
8151a4f1cd
@ -1,8 +1,10 @@
|
||||
import { authCached } from '@/auth/cache';
|
||||
import AdminPhotoMenuClient, { AdminPhotoMenuClientProps }
|
||||
from './AdminPhotoMenuClient';
|
||||
import AdminPhotoMenuClient from './AdminPhotoMenuClient';
|
||||
import { ComponentProps } from 'react';
|
||||
|
||||
export default async function AdminPhotoMenu(props: AdminPhotoMenuClientProps) {
|
||||
export default async function AdminPhotoMenu(
|
||||
props: ComponentProps<typeof AdminPhotoMenuClient>,
|
||||
) {
|
||||
const session = await authCached();
|
||||
return Boolean(session?.user?.email)
|
||||
? <AdminPhotoMenuClient {...props} />
|
||||
|
||||
@ -4,15 +4,12 @@ import { ComponentProps } from 'react';
|
||||
import { pathForAdminPhotoEdit } from '@/site/paths';
|
||||
import MoreMenu from '../components/MoreMenu';
|
||||
|
||||
export interface AdminPhotoMenuClientProps
|
||||
extends Omit<ComponentProps<typeof MoreMenu>, 'items'> {
|
||||
photoId: string
|
||||
}
|
||||
|
||||
export default function AdminPhotoMenuClient({
|
||||
photoId,
|
||||
...props
|
||||
}: AdminPhotoMenuClientProps) {
|
||||
}: Omit<ComponentProps<typeof MoreMenu>, 'items'> & {
|
||||
photoId: string
|
||||
}) {
|
||||
return (
|
||||
<MoreMenu {...{
|
||||
items: [{ href: pathForAdminPhotoEdit(photoId), label: 'Edit Photo' }],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user