keyan 18910fa2ed Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"
This reverts commit d0314ab73c42ebf85fe2f418dddd681af45dbc55.
2023-07-23 09:16:12 -05:00

28 lines
802 B
JavaScript

import Layout from '../../../components/layout'
import { ITEM_FULL } from '../../../fragments/items'
import Seo from '../../../components/seo'
import ItemFull from '../../../components/item-full'
import { getGetServerSideProps } from '../../../api/ssrApollo'
import { useQuery } from '@apollo/client'
export const getServerSideProps = getGetServerSideProps(ITEM_FULL, null,
data => !data.item || (data.item.status === 'STOPPED' && !data.item.mine))
export default function AnItem ({ data: { item } }) {
const { data } = useQuery(ITEM_FULL, {
variables: { id: item.id }
})
if (data) {
({ item } = data)
}
const sub = item.subName || item.root?.subName
return (
<Layout sub={sub} noSeo>
<Seo item={item} sub={sub} />
<ItemFull item={item} />
</Layout>
)
}