Skip to content

Commit

Permalink
Merge pull request #487 from masslight/473/26-120
Browse files Browse the repository at this point in the history
issue #473, removed annoying console logs
  • Loading branch information
GiladSchneider authored Oct 11, 2024
2 parents 6fb5ab2 + 832655b commit 213ad09
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
4 changes: 0 additions & 4 deletions packages/telemed-ehr/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ function App(): ReactElement {
const roleUnknown =
!currentUser || !currentUser.hasRole([RoleType.Administrator, RoleType.Staff, RoleType.Manager, RoleType.Provider]);

console.log(
`Photon Client: ${import.meta.env.VITE_APP_PHOTON_CLIENT_ID}, Photon Org: ${import.meta.env.VITE_APP_PHOTON_ORG_ID}`,
);

return (
<CustomThemeProvider>
<CssBaseline />
Expand Down
1 change: 1 addition & 0 deletions packages/telemed-ehr/app/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const createAppointment = async (
return chooseJson(response, VITE_APP_IS_LOCAL);
} catch (error: unknown) {
console.log(error);
return error;
}
};

Expand Down
1 change: 0 additions & 1 deletion packages/telemed-ehr/app/src/hooks/useOttehrUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ const useSyncPractitioner = (onSuccess: (data: SyncUserResponse) => void) => {
return useQuery(
['sync-user', zambdaClient],
async () => {
console.log('zambdaClient: ', zambdaClient);
if (!client) return undefined;
_practitionerSyncStarted = true;
const result = await client?.syncUser();
Expand Down
17 changes: 14 additions & 3 deletions packages/telemed-ehr/app/src/pages/AddPatient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export default function AddPatient(): JSX.Element {
const [slot, setSlot] = useState<string | undefined>();
const [loading, setLoading] = useState<boolean>(false);
const [searching, setSearching] = useState<boolean>(false);
const [errors, setErrors] = useState<{ submit?: boolean; phone?: boolean; search?: boolean }>({
const [errors, setErrors] = useState<{ age?: boolean; submit?: boolean; phone?: boolean; search?: boolean }>({
age: false,
submit: false,
phone: false,
search: false,
Expand Down Expand Up @@ -200,10 +201,14 @@ export default function AddPatient(): JSX.Element {
apiErr = true;
} finally {
setLoading(false);
if (response && !apiErr) {
if (!response.error && !apiErr) {
navigate('/visits');
} else {
setErrors({ submit: true });
if (response.error.includes('Patient age must be between')) {
setErrors({ age: true });
} else {
setErrors({ submit: true });
}
}
}
}
Expand Down Expand Up @@ -528,6 +533,7 @@ export default function AddPatient(): JSX.Element {
<Grid container direction="row" justifyContent="space-between">
<Grid item xs={12}>
<TextField
required
label="Email"
variant="outlined"
fullWidth
Expand Down Expand Up @@ -650,6 +656,11 @@ export default function AddPatient(): JSX.Element {
Please search for patients before adding
</Typography>
)}
{errors.age && (
<Typography color="error" variant="body2" mb={2}>
Patient age must be between 0 and 120 years
</Typography>
)}
<LoadingButton
variant="contained"
type="submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ export const index = async (input: ZambdaInput): Promise<APIGatewayProxyResult>
return response;
} catch (error: any) {
await topLevelCatch('create-appointment', error, input.secrets);
if (error.message.includes(`age not inside range of ${MINIMUM_AGE} to ${MAXIMUM_AGE}`)) {
return {
statusCode: 400,
body: JSON.stringify({ error: `Patient age must be between ${MINIMUM_AGE} and ${MAXIMUM_AGE} years` }),
};
}
return {
statusCode: 500,
body: JSON.stringify({ error: 'Internal error' }),
Expand Down
2 changes: 1 addition & 1 deletion packages/telemed-intake/zambdas/src/shared/validation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const MINIMUM_AGE = 0;
export const MAXIMUM_AGE = 26;
export const MAXIMUM_AGE = 120;
export const MAXIMUM_CHARACTER_LIMIT = 160;

// Phone number regex
Expand Down

0 comments on commit 213ad09

Please sign in to comment.