Skip to content

Commit 49600e0

Browse files
Domin0deYankai Zhu
andauthored
Minor Fix for Event Data Fetching (#60)
* Added backend events API * polished code * Fix to read fetched events data correctly --------- Co-authored-by: Yankai Zhu <[email protected]>
1 parent 1f2ba56 commit 49600e0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

backend/src/data/eventData.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ export async function fetchEvents() {
5959
`https://graph.facebook.com/${FB_API_VERSION}/${process.env.FB_EVENT_PAGE_ID}/events?access_token=${process.env.FB_ACCESS_TOKEN}&fields=id,name,cover,place,start_time,end_time`
6060
);
6161

62-
const res: Result<FacebookEventsResponse, FacebookError> = await response.json();
63-
if (!res || res.type === ResultType.Err) {
64-
console.log(`No events found...\n${res}`);
62+
if (!response || response.type === ResultType.Err) {
63+
console.log(`No events found...\n${response}`);
6564
return [];
6665
}
66+
const res: FacebookEventsResponse = await response.json();
6767

68-
const processed = res.value.data.map(
68+
const processed = res.data.map(
6969
(e) =>
7070
new EventInfo(
7171
e.id,

0 commit comments

Comments
 (0)