From 91777d8f361dcc69036a69c8eb0a97a509aa38f0 Mon Sep 17 00:00:00 2001 From: janrembold Date: Tue, 9 Jan 2024 15:23:04 +0100 Subject: [PATCH] fix: use session status for initial appointment check --- src/containers/bookings/components/Booking/booking.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/containers/bookings/components/Booking/booking.tsx b/src/containers/bookings/components/Booking/booking.tsx index 01096734c..1eb6def10 100644 --- a/src/containers/bookings/components/Booking/booking.tsx +++ b/src/containers/bookings/components/Booking/booking.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { useContext, useEffect, useState } from 'react'; import { ListItemInterface, + STATUS_EMPTY, UserDataContext, UserDataInterface } from '../../../../globalState'; @@ -45,6 +46,8 @@ export const Booking = () => { }); }, [userData]); + if (!session) return null; + return ( {appointmentLink && settings.calcomUrl && ( @@ -58,8 +61,7 @@ export const Booking = () => { 'metadata[user]': userData.userId, 'metadata[isInitialAppointment]': !session.consultant || - new Date(session.latestMessage).getTime() < - new Date(session.session.createDate).getTime(), + session.session.status === STATUS_EMPTY, 'metadata[sessionId]': session.session.id, 'metadata[rcToken]': getValueFromCookie('rc_token'), 'metadata[rcUserId]': getValueFromCookie('rc_uid'),