From ff2721e79196344da827992d1aff44400c75f22a Mon Sep 17 00:00:00 2001 From: iamkiddy Date: Thu, 4 Dec 2025 16:38:41 +0000 Subject: [PATCH] Refactor startMeeting and endMeeting functions to refetch appointment details Update the startMeeting and endMeeting functions in appointments.ts to ensure they return the latest appointment state by refetching details from the API. This change addresses the issue of receiving outdated appointment data and improves the accuracy of meeting management functionality. --- lib/actions/appointments.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/actions/appointments.ts b/lib/actions/appointments.ts index f1666c9..bb7ed4e 100644 --- a/lib/actions/appointments.ts +++ b/lib/actions/appointments.ts @@ -768,7 +768,9 @@ export async function startMeeting( throw new Error(extractErrorMessage(data as unknown as ApiError)); } - return (data as AppointmentResponse).appointment || data; + // The API returns { action, metadata, recording_url }, not an Appointment + // So we need to refetch the appointment to get the updated state + return await getAppointmentDetail(id); } export async function endMeeting(id: string): Promise { @@ -790,5 +792,7 @@ export async function endMeeting(id: string): Promise { throw new Error(extractErrorMessage(data as unknown as ApiError)); } - return (data as AppointmentResponse).appointment || data; + // The API returns a response object, not an Appointment + // So we need to refetch the appointment to get the updated state + return await getAppointmentDetail(id); }