Skip to content

Commit

Permalink
withBaseurl updated 🔧
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanptm committed Sep 28, 2024
1 parent 2306f1d commit fca1427
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
3 changes: 3 additions & 0 deletions client/app/(patient)/profile/default.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import PatientProfilePage from "./page";

export default ()=>PatientProfilePage;
31 changes: 17 additions & 14 deletions client/components/button/VideoSectionButtonPatient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Skeleton className="w-10 h-10" />

const handleClick = () => {
console.log('Video button clicked');
}

console.log(upcomingSections);



return (
<>
<ButtonV2 variant="ghost" size="icon" className="relative" onClick={handleClick}>
<Image
<Image
src="/assets/icons/utils/video.svg"
width={20}
height={20}
alt="Video Calls"
className="text-muted-foreground"
/>
{upcomingSections!.length > 0 && (
{upcomingSections && upcomingSections!.length > 0 && (
<Badge
variant="destructive"
className="absolute -right-1 -top-1 h-5 w-5 rounded-full p-0 text-xs flex items-center justify-center"
>
{upcomingSections!.length}
</Badge>
)}
)}
<span className="sr-only">View Upcoming Video Calls</span>
</ButtonV2>
<VideoCallModal
open={isModalOpen}
setOpen={setIsModalOpen}
sections={upcomingSections!}
link="/video-call"
/>
{upcomingSections && (
<VideoSectionsModel
open={isModalOpen}
setOpen={setIsModalOpen}
sections={upcomingSections!}
link="/video-call"
/>
)}
</>
)
}
Expand Down
4 changes: 2 additions & 2 deletions client/lib/api/patient/authorizedRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IPatient } from "@/types/entities";
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
import axios from "axios";

const getAuthTokens = () => {
try {
Expand Down Expand Up @@ -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;
};

Expand Down
13 changes: 7 additions & 6 deletions client/lib/utils/withTempBaseUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ export const withTempBaseUrl = async (
newBaseUrl: string,
config: AxiosRequestConfig
): Promise<AxiosResponse> => {
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;
}
};
2 changes: 1 addition & 1 deletion server/src/presentation/routers/video/VideoSectionRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

1 comment on commit fca1427

@vercel
Copy link

@vercel vercel bot commented on fca1427 Sep 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.