Skip to content

Commit

Permalink
fix: use session status for initial appointment check
Browse files Browse the repository at this point in the history
  • Loading branch information
janrembold committed Jan 9, 2024
1 parent 6958266 commit 91777d8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/containers/bookings/components/Booking/booking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import { useContext, useEffect, useState } from 'react';
import {
ListItemInterface,
STATUS_EMPTY,
UserDataContext,
UserDataInterface
} from '../../../../globalState';
Expand Down Expand Up @@ -45,6 +46,8 @@ export const Booking = () => {
});
}, [userData]);

if (!session) return null;

return (
<React.Fragment>
{appointmentLink && settings.calcomUrl && (
Expand All @@ -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'),
Expand Down

0 comments on commit 91777d8

Please sign in to comment.