@@ -94,7 +94,7 @@ function UserProfile() {
94
94
return res ;
95
95
}
96
96
} catch ( e ) {
97
- console . log ( "extend error" ) ;
97
+ console . log ( "error in getpublicusername cloud function " ) ;
98
98
}
99
99
} ;
100
100
const handleSubmit = async ( e ) => {
@@ -153,25 +153,15 @@ function UserProfile() {
153
153
const extClass = localStorage . getItem ( "extended_class" ) ;
154
154
const extData = JSON . parse ( localStorage . getItem ( "Extand_Class" ) ) ;
155
155
const ExtUserId = extData [ 0 ] . objectId ;
156
- let body ;
157
- if ( publicUserName ) {
158
- body = {
159
- Phone : obj ?. Phone || "" ,
160
- Name : obj . Name ,
161
- HeaderDocId : isDisableDocId ,
162
- JobTitle : jobTitle ,
163
- Company : company ,
164
- UserName : publicUserName
165
- } ;
166
- } else {
167
- body = {
168
- Phone : obj ?. Phone || "" ,
169
- Name : obj . Name ,
170
- HeaderDocId : isDisableDocId ,
171
- JobTitle : jobTitle ,
172
- Company : company
173
- } ;
174
- }
156
+ const body = {
157
+ Phone : obj ?. Phone || "" ,
158
+ Name : obj . Name ,
159
+ HeaderDocId : isDisableDocId ,
160
+ JobTitle : jobTitle ,
161
+ Company : company ,
162
+ UserName : publicUserName || ""
163
+ } ;
164
+
175
165
await axios . put (
176
166
parseBaseUrl + "classes/" + extClass + "/" + ExtUserId ,
177
167
body ,
@@ -282,7 +272,7 @@ function UserProfile() {
282
272
setOtpLoader ( false ) ;
283
273
alert ( "OTP sent on you email" ) ;
284
274
} ;
285
- //function to handle onchange user name nad restict 6 characters username for free users
275
+ //function to handle onchange username and restrict 6- characters username for free users
286
276
const handleOnchangeUserName = ( e ) => {
287
277
const value = e . target . value ;
288
278
if ( value . length > 6 && ! isSubscribe ) {
@@ -294,6 +284,15 @@ function UserProfile() {
294
284
setPublicUserName ( e . target . value ) ;
295
285
}
296
286
} ;
287
+ const handleCancel = ( ) => {
288
+ setEditMode ( false ) ;
289
+ SetName ( localStorage . getItem ( "username" ) ) ;
290
+ SetPhone ( UserProfile && UserProfile . phone ) ;
291
+ setImage ( localStorage . getItem ( "profileImg" ) ) ;
292
+ setPublicUserName ( extendUser && extendUser ?. [ 0 ] ?. UserName ) ;
293
+ setCompany ( extendUser && extendUser ?. [ 0 ] ?. Company ) ;
294
+ setJobTitle ( extendUser ?. [ 0 ] ?. JobTitle ) ;
295
+ } ;
297
296
return (
298
297
< React . Fragment >
299
298
< Title title = { "Profile" } />
@@ -450,22 +449,37 @@ function UserProfile() {
450
449
) }
451
450
</ span >
452
451
</ li >
453
- { /* {!isEnableSubscription && ( */ }
454
- < li className = "flex justify-between items-center border-t-[1px] border-gray-300 py-2 break-all" >
455
- < span className = "font-semibold" > Public profile:</ span >
456
- < div className = "flex items-center" >
457
- < span > opensign.me/</ span >
458
-
459
- < input
460
- onChange = { handleOnchangeUserName }
461
- value = { publicUserName }
462
- disabled = { ! editmode }
463
- placeholder = "enter user name"
464
- className = "border-[1px] border-gray-200 rounded-[3px]"
465
- />
466
- </ div >
467
- </ li >
468
- { /* )} */ }
452
+ { ! isEnableSubscription && (
453
+ < li className = "flex justify-between items-center border-t-[1px] border-gray-300 py-2 break-all" >
454
+ < span className = "font-semibold" >
455
+ Public profile :{ " " }
456
+ < Tooltip
457
+ message = { `this is your public URL. Copy or share it
458
+ with the signer, and you will be able to see
459
+ all your publicly set templates.` }
460
+ />
461
+ </ span >
462
+ < div className = "flex items-center" >
463
+ < span > opensign.me/</ span >
464
+ { editmode ? (
465
+ < input
466
+ onChange = { handleOnchangeUserName }
467
+ value = { publicUserName }
468
+ disabled = { ! editmode }
469
+ placeholder = "enter user name"
470
+ className = "border-[1px] border-gray-200 rounded-[3px]"
471
+ />
472
+ ) : (
473
+ < input
474
+ value = { extendUser ?. [ 0 ] ?. UserName }
475
+ disabled
476
+ placeholder = "enter user name"
477
+ className = "border-[1px] border-gray-200 rounded-[3px]"
478
+ />
479
+ ) }
480
+ </ div >
481
+ </ li >
482
+ ) }
469
483
< li className = "border-y-[1px] border-gray-300 break-all" >
470
484
< div className = "flex justify-between items-center py-2" >
471
485
< span
@@ -536,7 +550,7 @@ function UserProfile() {
536
550
type = "button"
537
551
onClick = { ( ) => {
538
552
if ( editmode ) {
539
- setEditMode ( false ) ;
553
+ handleCancel ( ) ;
540
554
} else {
541
555
navigate ( "/changepassword" ) ;
542
556
}
0 commit comments