coronasafe/care_fe

View on GitHub
src/pages/PublicAppointments/PatientSelect.tsx

Summary

Maintainability
C
7 hrs
Test Coverage

Showing 4 of 4 total issues

Function PatientSelect has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export default function PatientSelect({
facilityId,
staffId,
}: {
facilityId: string;
Severity: Minor
Found in src/pages/PublicAppointments/PatientSelect.tsx - About 2 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

onSuccess: (data: Appointment) => {
toast.success(t("appointment_created_success"));
queryClient.invalidateQueries({
queryKey: [
["patients", tokenData.phoneNumber],
Severity: Major
Found in src/pages/PublicAppointments/PatientSelect.tsx and 1 other location - About 3 hrs to fix
src/pages/PublicAppointments/Schedule.tsx on lines 157..168

Similar blocks of code found in 2 locations. Consider refactoring.
Open

mutationFn: (body: AppointmentCreateRequest) =>
mutate(PublicAppointmentApi.createAppointment, {
pathParams: { id: selectedSlot?.id },
body,
headers: {
Severity: Major
Found in src/pages/PublicAppointments/PatientSelect.tsx and 1 other location - About 1 hr to fix
src/pages/PublicAppointments/PatientRegistration.tsx on lines 129..136

Similar blocks of code found in 2 locations. Consider refactoring.
Open

} else if (!tokenData) {
toast.error(t("phone_number_not_found"));
navigate(`/facility/${facilityId}/appointments/${staffId}/otp/send`);
} else if (!selectedSlot) {
toast.error(t("selected_slot_not_found"));
Severity: Minor
Found in src/pages/PublicAppointments/PatientSelect.tsx and 1 other location - About 30 mins to fix
src/pages/PublicAppointments/Schedule.tsx on lines 58..64
Category
Status