File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
app/[locale]/dashboard/[entityType]/[entitySlug]/profile Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ const updateUserMutation: any = graphql(`
3535 }
3636` ) ;
3737
38+ const urlRegex = / ^ ( h t t p s ? : \/ \/ ) ( [ \w - ] + \. ) + [ \w - ] { 2 , } ( \/ \S * ) ? $ / ;
39+
3840const UserProfile = ( ) => {
3941 const params = useParams < { entityType : string ; entitySlug : string } > ( ) ;
4042
@@ -112,7 +114,22 @@ const UserProfile = () => {
112114 if ( ! formValidation ) {
113115 toast ( 'Please fill all the required fields' ) ;
114116 return ;
115- } else {
117+ }
118+ if ( formData . githubProfile && ! urlRegex . test ( formData . githubProfile ) ) {
119+ toast . error ( 'Enter a valid GitHub URL' ) ;
120+ return ;
121+ }
122+
123+ if ( formData . linkedinProfile && ! urlRegex . test ( formData . linkedinProfile ) ) {
124+ toast . error ( 'Enter a valid LinkedIn URL' ) ;
125+ return ;
126+ }
127+
128+ if ( formData . twitterProfile && ! urlRegex . test ( formData . twitterProfile ) ) {
129+ toast . error ( 'Enter a valid Twitter URL' ) ;
130+ return ;
131+ }
132+ else {
116133 const inputData : UpdateUserInput = {
117134 firstName : formData . firstName ,
118135 lastName : formData . lastName ,
You can’t perform that action at this time.
0 commit comments