File tree Expand file tree Collapse file tree 2 files changed +6
-16
lines changed
app/[locale]/certificates/[slug] Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -3,31 +3,21 @@ import { notFound } from "next/navigation";
33import Certificate from "@/features/certificate/Certificate" ;
44import { CertificateType } from "@/features/certificate/types" ;
55
6- export async function getCertificate ( slug : string ) {
7- try {
8- const response = await fetch ( `https://moonlight.hammercode.org/v1/certificates/${ slug } ` ) ;
9- if ( ! response . ok ) return null ;
10-
11- return response . json ( ) ;
12- } catch ( error ) {
13- console . error ( "Error fetching certificate:" , error ) ;
14- return null ;
15- }
16- }
17-
186type Props = {
197 params : {
208 slug : string ;
219 } ;
2210} ;
2311
2412const CertificateDetail = async ( { params } : Props ) => {
25- const certificate : CertificateType = await getCertificate ( params . slug ) ;
26- if ( ! certificate . name ) {
13+ const data = await fetch ( `https://moonlight.hammercode.org/v1/certificates/${ params . slug } ` ) ;
14+ const certificateDetail : CertificateType = await data . json ( ) ;
15+
16+ if ( ! certificateDetail . name ) {
2717 return notFound ( ) ;
2818 }
2919
30- return < Certificate certificate = { certificate } /> ;
20+ return < Certificate certificate = { certificateDetail } /> ;
3121} ;
3222
3323export default CertificateDetail ;
Original file line number Diff line number Diff line change 3131 },
3232 "HomePage" : {
3333 "section-hero" : {
34- "title" : " Boost Your Skills with High-Quality Classes!" ,
34+ "title" : " Boost Your Skills with High-Quality Classes! STG " ,
3535 "description" : " Hammercode is a tech community based in Palu, Indonesia" ,
3636 "join-button" : " Join Community"
3737 },
You can’t perform that action at this time.
0 commit comments