Skip to content

Commit 823f619

Browse files
committed
pull from master branch
2 parents 77cbb3f + 7955bac commit 823f619

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/app/[locale]/certificates/[slug]/page.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,21 @@ import { notFound } from "next/navigation";
33
import Certificate from "@/features/certificate/Certificate";
44
import { 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-
186
type Props = {
197
params: {
208
slug: string;
219
};
2210
};
2311

2412
const 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

3323
export default CertificateDetail;

src/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
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
},

0 commit comments

Comments
 (0)