Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/ced-portal-fe/src/components/ContactRow/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const getTypeError = ({
contact,
required,
}: GetContactErrorParams) =>
getRequiredError(attempted, required, contact.value);
getRequiredError(attempted, required, contact.type);

export const getContactError = ({
attempted,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box } from '@mui/material';
import { AppTextField, FormField } from '../../../../components';

Check warning on line 2 in apps/ced-portal-fe/src/pages/CreateBenefit/StepTwo/WebsiteManagementSection/WebsiteFields.tsx

View workflow job for this annotation

GitHub Actions / Code Review / js_code_review

'FormField' is defined but never used
import {
selectWebsiteForm,
selectWebsiteUrlError,
Expand Down Expand Up @@ -36,24 +36,22 @@

return (
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<FormField
<AppTextField
value={name ?? ''}
label="Nome"
required
onChange={(e) => dispatch(setWebsiteName(e.target.value))}
{...nameField}
>
<AppTextField />
</FormField>
<FormField
/>

<AppTextField
value={url ?? ''}
label="URL"
required
onChange={(e) => dispatch(setWebsiteUrl(e.target.value))}
{...urlField}
>
<AppTextField onBlur={() => dispatch(validateWebsiteUrl())} />
</FormField>
onBlur={() => dispatch(validateWebsiteUrl())}
/>
</Box>
);
}
5 changes: 4 additions & 1 deletion apps/ced-portal-fe/src/utils/urlValidator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export function isValidHttpsUrl(value: string): boolean {
export function isValidHttpsUrl(value: string, required?: boolean): boolean {
try {
if (!required && !value.trim()) {
return true;
}
return new URL(value.trim()).protocol === 'https:';
} catch {
return false;
Expand Down
Loading