Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const getStaticPaths: GetStaticPaths<Params> = async () => {
- const res = await clubService.getClubs();
- const paths = res.data.data.map((path) => ({
- params: {
- id: path.id.toString(),
- },
- }));
- return {
- paths,
- fallback: false,
- };
- };
- export const getStaticProps: GetStaticProps<IClubData> = async ({
- params,
- locale,
- }) => {
- let clubData;
- try {
- const clubResponse = await clubService.getClub(Number(params?.id));
- clubData = clubResponse.data.data;
- return {
- props: {
- ...(await serverSideTranslations(locale ?? "en", ["common", "header"])),
- club: clubData,
- },
- };
- } catch (error) {
- console.error(error);
- return {
- notFound: true,
- };
- }
- };
- export default ClubPage;
Advertisement
Add Comment
Please, Sign In to add comment