1
1
import { 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" ;
5
2
import Head from "next/head" ;
6
3
import DefaultErrorPage from "next/error" ;
4
+ import { Show } from "../../../components/{{{lc}}}/Show" ;
5
+ import { { { { ucf } } } } from "../../../types/{{{ucf}}}" ;
6
+ import { fetch , getPaths } from "../../../utils/dataAccess" ;
7
7
import { useMercure } from "../../../utils/mercure" ;
8
- import { getPathsFromHydraResponse } from "../../../utils/helpers" ;
9
8
10
9
interface Props {
11
10
{ { { lc } } } : { { { ucf } } } ;
12
11
hubURL: null | string ;
12
+ text: string ;
13
13
} ;
14
14
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 ) ;
17
17
18
- if ( ! { { { lc} } } ) {
18
+ if ( ! { { { lc} } } Data ) {
19
19
return < DefaultErrorPage statusCode = { 404 } / > ;
20
20
}
21
21
@@ -26,7 +26,7 @@ const Page: NextComponentType<NextPageContext, Props, Props> = (props) => {
26
26
< title > { `Show {{{ucf}}} ${ { { ~ lc } }['@id'] }` } </ title >
27
27
</ Head >
28
28
</ div >
29
- < Show { { { lc} } } = { { { { lc} } } } text = { data . text } / >
29
+ < Show { { { lc} } } = { { { { lc} } } Data } text = { text} / >
30
30
</div >
31
31
) ;
32
32
} ;
@@ -43,12 +43,15 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
43
43
revalidate : 1 ,
44
44
} ;
45
45
}
46
- export const getStaticPaths : GetStaticPaths = async ( ) => {
46
+
47
+ export const getStaticPaths : GetStaticPaths = async ( ) => {
47
48
const response = await fetch ( "/{{{name}}}" ) ;
48
- const paths = await getPathsFromHydraResponse ( response , false ) ;
49
+ const paths = await getPaths ( response , "{{{name}}}" , false ) ;
50
+
49
51
return {
50
52
paths,
51
- fallback :true
52
- }
53
+ fallback : true ,
54
+ } ;
53
55
}
56
+
54
57
export default Page ;
0 commit comments