Skip to content

Commit abd85e3

Browse files
committed
fix: some Copilot bugs
1 parent eaa3dad commit abd85e3

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

app/activities/[id]/page.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ const DATA_EDIT_URL =
2828

2929
async function findActivity(id: string) {
3030
const res = await fetch(ACTIVITIES_API_URL, { cache: 'force-cache' });
31-
if (!res.ok) throw new Error(`Failed to fetch activities: ${res.status}`);
31+
32+
if (!res.ok) throw new URIError(`Failed to fetch activities: ${res.status}`);
33+
3234
const externalData = (await res.json()) as ExternalDeadlineItem[];
35+
3336
for (const raw of externalData) {
3437
const item = transformItem(raw);
38+
3539
for (const event of item.events)
3640
if (event.id === id) return { item, event };
3741
}

app/restaurants/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default async function RestaurantDetailPage({
7070
</div>
7171

7272
{/* Food types */}
73-
{restaurant.food && restaurant.food.length > 0 && (
73+
{restaurant.food?.[0] && (
7474
<div className="text-sm">
7575
<span className="font-medium text-gray-700">
7676
美食类型

0 commit comments

Comments
 (0)