New news detail json

This commit is contained in:
Yifei Hu 2024-07-09 14:17:37 +08:00
parent 858dc41ebb
commit 146a3fdd5e
15 changed files with 2336 additions and 3021 deletions

9
ui/lib/fetchNewsData.ts Normal file
View file

@ -0,0 +1,9 @@
export async function fetchNewsData(id: string) {
const response = await fetch(
`https://raw.githubusercontent.com/newspedia-crew/newspedia-web/intern-change/public/data/${id}.json`,
);
if (!response.ok) {
return null;
}
return response.json();
}