11import { GetStaticPaths , GetStaticProps , NextComponentType , NextPageContext } from "next" ;
2- import { Show } from "../../../components/{{{lc}}}/Show" ;
3- import { { { { ucf } } } } from "../../../types/{{{ucf}}}" ;
4- import { fetch } from "../../../utils/dataAccess" ;
52import Head from "next/head" ;
63import DefaultErrorPage from "next/error" ;
4+ import { Show } from "../../../components/{{{lc}}}/Show" ;
5+ import { { { { ucf } } } } from "../../../types/{{{ucf}}}" ;
6+ import { fetch , getPaths } from "../../../utils/dataAccess" ;
77import { useMercure } from "../../../utils/mercure" ;
8- import { getPathsFromHydraResponse } from "../../../utils/helpers" ;
98
109interface Props {
1110 { { { lc } } } : { { { ucf } } } ;
1211 hubURL: null | string ;
12+ text: string ;
1313} ;
1414
15- const Page : NextComponentType < NextPageContext , Props , Props > = ( props ) => {
16- const { { { lc} } } = props . hubURL === null ? props . { { { lc } } } : useMercure ( props . { { { lc } } } , props . hubURL ) ;
15+ const Page : NextComponentType < NextPageContext , Props , Props > = ( { { { { lc } } } , hubURL , text } ) => {
16+ const { { { lc} } } Data = useMercure ( { { { lc} } } , hubURL ) ;
1717
18- if ( ! { { { lc} } } ) {
18+ if ( ! { { { lc} } } Data ) {
1919 return < DefaultErrorPage statusCode = { 404 } / > ;
2020 }
2121
@@ -26,7 +26,7 @@ const Page: NextComponentType<NextPageContext, Props, Props> = (props) => {
2626 < title > { `Show {{{ucf}}} ${ { { ~ lc } }['@id'] }` } </ title >
2727 </ Head >
2828 </ div >
29- < Show { { { lc} } } = { { { { lc} } } } text = { data . text } / >
29+ < Show { { { lc} } } = { { { { lc} } } Data } text = { text} / >
3030 </div >
3131 ) ;
3232} ;
@@ -43,12 +43,15 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
4343 revalidate : 1 ,
4444 } ;
4545}
46- export const getStaticPaths : GetStaticPaths = async ( ) => {
46+
47+ export const getStaticPaths : GetStaticPaths = async ( ) => {
4748 const response = await fetch ( "/{{{name}}}" ) ;
48- const paths = await getPathsFromHydraResponse ( response , false ) ;
49+ const paths = await getPaths ( response , "{{{name}}}" , false ) ;
50+
4951 return {
5052 paths,
51- fallback :true
52- }
53+ fallback : true ,
54+ } ;
5355}
56+
5457export default Page ;
0 commit comments