Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

I2 17/events api hotfix#61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Domin0de merged 9 commits intoqafromI2-17/events-api
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletionsbackend/src/data/eventData.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,9 +59,9 @@ export async function fetchEvents() {
`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`
);

if (!response || response.type === ResultType.Err) {
console.log(`No events found...\n${response}`);
return [];
if (!response.ok) {
throw new Error(JSON.stringify(response.json()));

}
const res: FacebookEventsResponse = await response.json();

Expand All@@ -85,22 +85,17 @@ export async function fetchEvent(id: string) {
`https://graph.facebook.com/${FB_API_VERSION}/${id}?access_token=${process.env.FB_ACCESS_TOKEN}&fields=id,name,cover,place,start_time,end_time`
);

const res: Result<FacebookEvent, FacebookError> = await response.json();

if (!res || res.type === ResultType.Err) {
throw new Error(
`Couldn't fetch details for event ${id}\n${inspect(
Object.getOwnPropertyDescriptor(res, "error")?.value
)}`
);
if (!response.ok) {
throw new Error(`Couldn't fetch details for event ${id}\n${JSON.stringify(response.json())}`);
}
const res: FacebookEvent = await response.json();

return new EventInfo(
res.value.id,
res.value.name,
res.value.start_time,
res.value.end_time,
res.value.place?.name ?? DEFAULT_EVENT_LOCATION,
res.value.cover?.source ?? DEFAULT_EVENT_IMAGE
res.id,
res.name,
res.start_time,
res.end_time,
res.place?.name ?? DEFAULT_EVENT_LOCATION,
res.cover?.source ?? DEFAULT_EVENT_IMAGE
);
}
2 changes: 1 addition & 1 deletionbackend/src/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,7 @@ dotenv.config();
(async () => {
try {
const events = await fetchEvents();
eventInfoMutex.runExclusive(() => eventInfo.concat(events));
eventInfoMutex.runExclusive(() => eventInfo.push(...events));
console.log("Events fetched successfully");
} catch (error) {
// do we ungracefully bail out here???
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp