Skip to content

Commit

Permalink
add fallback url for goBack() (#10146)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishith25 authored Feb 21, 2025
1 parent 0457cfa commit 69eb11c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/Auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ const Login = (props: LoginProps) => {
}}
maxLength={5}
placeholder="Enter 5-digit OTP"
autoFocus
/>
{otpValidationError && (
<p className="text-sm text-red-500">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Patient/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ export default function PatientRegistration(
<Button
variant={"secondary"}
type="button"
onClick={() => goBack()}
onClick={() => goBack(`/facility/${facilityId}/patients`)}
>
{t("cancel")}
</Button>
Expand Down
10 changes: 9 additions & 1 deletion src/pages/Appointments/BookAppointment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,15 @@ export default function BookAppointment(props: Props) {
</div>

<div className="flex justify-end gap-4">
<Button variant="outline" type="button" onClick={() => goBack()}>
<Button
variant="outline"
type="button"
onClick={() =>
goBack(
`/facility/${props.facilityId}/patient/${props.patientId}/appointments`,
)
}
>
{t("cancel")}
</Button>
<Button
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Patients/VerifyPatient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export default function VerifyPatient(props: { facilityId: string }) {
<Button
variant={"primary_gradient"}
className="gap-3 group"
onClick={() => goBack()}
onClick={() => goBack(`/facility/${props.facilityId}/patients`)}
>
{t("go_back")}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/PublicAppointments/Schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export function ScheduleAppointment(props: AppointmentsProps) {
<Button
variant="outline"
className="border border-secondary-400"
onClick={() => goBack()}
onClick={() => goBack(`/facility/${facilityId}`)}
>
<span className="text-sm underline">{t("back")}</span>
</Button>
Expand Down
9 changes: 7 additions & 2 deletions src/pages/PublicAppointments/auth/PatientLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ export default function PatientLogin({
{t("enter_the_verification_code")}
</FormLabel>
<FormControl>
<InputOTP maxLength={5} {...field} className="focus:ring-0">
<InputOTP
maxLength={5}
{...field}
className="focus:ring-0"
autoFocus
>
<InputOTPGroup>
<InputOTPSlot index={0} />
</InputOTPGroup>
Expand Down Expand Up @@ -229,7 +234,7 @@ export default function PatientLogin({
className="border border-secondary-400"
onClick={() =>
page === "send"
? goBack()
? goBack(`/facility/${facilityId}`)
: navigate(
`/facility/${facilityId}/appointments/${staffId}/otp/send`,
)
Expand Down

0 comments on commit 69eb11c

Please sign in to comment.