2022-10-27 17:11:10 +02:00
|
|
|
import { GetServerSideProps } from "next";
|
|
|
|
import fetchAPI from "../../../lib/fetch";
|
2022-11-21 04:16:07 +01:00
|
|
|
import { Member } from "../../../lib/types";
|
|
|
|
import PersonPage from "../../../components/PersonPage";
|
2022-10-27 17:11:10 +02:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
member: Member;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function MemberPage({ member }: Props) {
|
2022-11-21 04:16:07 +01:00
|
|
|
return <PersonPage person={member} />;
|
2022-10-27 17:11:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
|
|
|
try {
|
|
|
|
const member = await fetchAPI<Member>(
|
|
|
|
`/users/${context.params!.user}/members/${context.params!.member}`
|
|
|
|
);
|
|
|
|
|
|
|
|
return { props: { member } };
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
|
|
|
|
return { notFound: true };
|
|
|
|
}
|
|
|
|
};
|