diff --git a/client/app/(patient)/profile/default.tsx b/client/app/(patient)/profile/default.tsx new file mode 100644 index 00000000..6a4d40b2 --- /dev/null +++ b/client/app/(patient)/profile/default.tsx @@ -0,0 +1,3 @@ +import PatientProfilePage from "./page"; + +export default ()=>PatientProfilePage; \ No newline at end of file diff --git a/client/components/button/VideoSectionButtonPatient.tsx b/client/components/button/VideoSectionButtonPatient.tsx index b9e4e933..121078b6 100644 --- a/client/components/button/VideoSectionButtonPatient.tsx +++ b/client/components/button/VideoSectionButtonPatient.tsx @@ -4,48 +4,51 @@ import React, { memo, useState } from 'react'; import { ButtonV2 } from './ButtonV2'; import Image from 'next/image'; import { Badge } from '@/components/ui/badge' -import VideoCallModal from '../models/VideoSectionsModel'; import { useGetSectionsInOneDayPatient } from '@/lib/hooks/video/usePatient'; import { Skeleton } from '../ui/skeleton'; +import dynamic from 'next/dynamic'; + +const VideoSectionsModel = dynamic(import('@/components/models/VideoSectionsModel')); const VideoSectionButtonPatient = () => { const { data: upcomingSections, isLoading } = useGetSectionsInOneDayPatient(); const [isModalOpen, setIsModalOpen] = useState(false); - console.log(upcomingSections); - - if(isLoading) return - const handleClick = () => { console.log('Video button clicked'); } + console.log(upcomingSections); + + return ( <> - Video Calls - {upcomingSections!.length > 0 && ( + {upcomingSections && upcomingSections!.length > 0 && ( {upcomingSections!.length} - )} + )} View Upcoming Video Calls - + {upcomingSections && ( + + )} ) } diff --git a/client/lib/api/patient/authorizedRoutes.ts b/client/lib/api/patient/authorizedRoutes.ts index d3819600..e70da45d 100644 --- a/client/lib/api/patient/authorizedRoutes.ts +++ b/client/lib/api/patient/authorizedRoutes.ts @@ -1,5 +1,5 @@ import { IPatient } from "@/types/entities"; -import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios"; +import axios from "axios"; const getAuthTokens = () => { try { @@ -68,7 +68,7 @@ patientAxiosInstance.interceptors.response.use( ); export const getPatientProfile = async () => { - const response = await patientAxiosInstance.get(`/profile`); + const response = await patientAxiosInstance.get("/profile"); return response.data; }; diff --git a/client/lib/utils/withTempBaseUrl.ts b/client/lib/utils/withTempBaseUrl.ts index 7505bb12..3aeb7e50 100644 --- a/client/lib/utils/withTempBaseUrl.ts +++ b/client/lib/utils/withTempBaseUrl.ts @@ -5,13 +5,14 @@ export const withTempBaseUrl = async ( newBaseUrl: string, config: AxiosRequestConfig ): Promise => { - const originalBaseUrl = instance.defaults.baseURL; - + const updatedConfig = { + ...config, + baseURL: newBaseUrl, + }; try { - instance.defaults.baseURL = newBaseUrl; - const response = await instance(config); + const response = await instance(updatedConfig); return response; - } finally { - instance.defaults.baseURL = originalBaseUrl; + } catch (error) { + throw error; } }; diff --git a/server/src/presentation/routers/video/VideoSectionRoute.ts b/server/src/presentation/routers/video/VideoSectionRoute.ts index e1bc1f72..2360ffc3 100644 --- a/server/src/presentation/routers/video/VideoSectionRoute.ts +++ b/server/src/presentation/routers/video/VideoSectionRoute.ts @@ -19,8 +19,8 @@ const videoController = new VideoController(getVideoSectionUseCase); const authorizeDoctor = new DoctorAuthMiddleware(tokenService); const authorizePatient = new PatientAuthMiddleware(tokenService); -router.get("/doctor/day", authorizeDoctor.exec, videoController.getSectionsInOneDayDoctor.bind(videoController)); router.get("/patient/day", authorizePatient.exec, videoController.getSectionsInOneDayPatient.bind(videoController)); +router.get("/doctor/day", authorizeDoctor.exec, videoController.getSectionsInOneDayDoctor.bind(videoController)); export default router;