MCPcopy Create free account
hub / github.com/dailydotdev/apps / validate

Function validate

packages/shared/src/components/auth/RegistrationFieldsForm.tsx:101–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99 const inputUsername = touched.username ? values.username : suggestedUsername;
100
101 const validate = () => {
102 const errors: Partial<Record<keyof RegistrationFieldsFormValues, string>> =
103 {};
104 if (!values.email) {
105 errors.email = 'Email is required.';
106 }
107 if (!values.name) {
108 errors.name = 'Name is required.';
109 }
110 if (!values.password && withPassword) {
111 errors.password = 'Password is required.';
112 }
113 if (!inputUsername) {
114 errors.username = 'Username is required.';
115 }
116 if (!values.experienceLevel) {
117 errors.experienceLevel = 'Experience level is required.';
118 }
119 return errors;
120 };
121
122 const localErrors = validate();
123

Callers 2

RegistrationFieldsFormFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected