Skip to content

Commit

Permalink
Revert "Videochat page updates"
Browse files Browse the repository at this point in the history
  • Loading branch information
GiladSchneider authored Nov 11, 2024
1 parent 4fc2a67 commit 7687b9e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { PromiseReturnType } from 'ottehr-utils';
export const useJoinCall = (
apiClient: ZapEHRAPIClient | null,
onSuccess: (data: PromiseReturnType<ReturnType<ZapEHRAPIClient['joinCall']>>) => void,
setError: (err: Error) => void,
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
) => {
return useQuery(
Expand All @@ -22,8 +21,7 @@ export const useJoinCall = (
},
{
onSuccess,
onError: (err: Error) => {
setError(err);
onError: (err) => {
console.error('Error during executing joinCall: ', err);
},
},
Expand Down
6 changes: 3 additions & 3 deletions packages/telemed-intake/app/src/pages/ReviewPaperwork.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { isPaperworkPageComplete } from '../utils/paperworkCompleted';

const ReviewPaperwork = (): JSX.Element => {
const navigate = useNavigate();
const { appointmentID, visitService, visitType } = getSelectors(useAppointmentStore, [
const { appointmentID, scheduleType, visitType } = getSelectors(useAppointmentStore, [
'appointmentID',
'visitService',
'scheduleType',
'visitType',
]);
const fileURLs = useFilesStore((state) => state.fileURLs);
Expand Down Expand Up @@ -91,7 +91,7 @@ const ReviewPaperwork = (): JSX.Element => {
onSuccess: async () => {
usePaperworkStore.setState({ paperworkQuestions: undefined, completedPaperwork: undefined });
useFilesStore.setState({ fileURLs: undefined });
if (visitService === 'telemedicine' && visitType === 'now') {
if (scheduleType === 'provider' && visitType === 'now') {
navigate(`${IntakeFlowPageRoute.WaitingRoom.path}?appointment_id=${appointmentID}`);
} else {
navigate(IntakeFlowPageRoute.ThankYou.path);
Expand Down
38 changes: 11 additions & 27 deletions packages/telemed-intake/app/src/pages/VideoChatPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useState } from 'react';
import { Container, Typography } from '@mui/material';
import { FC } from 'react';
import { Container } from '@mui/material';
import { useSearchParams } from 'react-router-dom';
import { getSelectors } from 'ottehr-utils';
import { IntakeFlowPageRoute } from '../App';
Expand All @@ -17,8 +17,6 @@ const VideoChatPage: FC = () => {
const videoCallState = getSelectors(useVideoCallStore, ['meetingData']);
const meetingManager = useMeetingManager();

const [error, setError] = useState<Error | null>(null);

const apiClient = useZapEHRAPIClient();
const [searchParams] = useSearchParams();
const urlAppointmentID = searchParams.get('appointmentID');
Expand All @@ -27,32 +25,18 @@ const VideoChatPage: FC = () => {
useAppointmentStore.setState(() => ({ appointmentID: urlAppointmentID }));
}

useJoinCall(
apiClient,
async (response) => {
useVideoCallStore.setState({ meetingData: response });

const meetingSessionConfiguration = new MeetingSessionConfiguration(response.Meeting, response.Attendee);
const options = {
deviceLabels: DeviceLabels.AudioAndVideo,
};
useJoinCall(apiClient, async (response) => {
useVideoCallStore.setState({ meetingData: response });

await meetingManager.join(meetingSessionConfiguration, options);
const meetingSessionConfiguration = new MeetingSessionConfiguration(response.Meeting, response.Attendee);
const options = {
deviceLabels: DeviceLabels.AudioAndVideo,
};

await meetingManager.start();
},
setError,
);
await meetingManager.join(meetingSessionConfiguration, options);

if (error) {
return (
<CustomContainer useEmptyBody title="" bgVariant={IntakeFlowPageRoute.VideoCall.path}>
<Typography sx={{ color: 'primary.contrast' }} variant="h6">
{error.message}
</Typography>
</CustomContainer>
);
}
await meetingManager.start();
});

if (!videoCallState.meetingData) {
return (
Expand Down
3 changes: 0 additions & 3 deletions packages/telemed-intake/app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ export default (env) => {
open: 'patient-portal',
},
plugins,
define: {
global: 'window',
},
}),
);
};

0 comments on commit 7687b9e

Please sign in to comment.