()
| 48 | // eslint-disable-next-line |
| 49 | }, []); |
| 50 | const fetchUserSign = async () => { |
| 51 | const User = Parse.User.current(); |
| 52 | if (User) { |
| 53 | const userId = { |
| 54 | __type: "Pointer", |
| 55 | className: "_User", |
| 56 | objectId: User.id |
| 57 | }; |
| 58 | try { |
| 59 | const signRes = await Parse.Cloud.run("getdefaultsignature", { |
| 60 | userId: User.id |
| 61 | }); |
| 62 | if (signRes) { |
| 63 | const res = signRes.toJSON(); |
| 64 | setId(res.objectId); |
| 65 | if (res?.SignatureName) { |
| 66 | const sanitizename = generateTitleFromFilename(res?.SignatureName); |
| 67 | const replaceSpace = sanitizeFileName(sanitizename); |
| 68 | setSignName(replaceSpace); |
| 69 | } |
| 70 | setImage(res?.ImageURL); |
| 71 | if (res && res.Initials) { |
| 72 | // setInitials(res.Initials); |
| 73 | setIsInitials(true); |
| 74 | setImgInitials(res?.Initials); |
| 75 | } |
| 76 | if (res && res?.Stamp) { |
| 77 | setStamp(res?.Stamp); |
| 78 | } |
| 79 | } else { |
| 80 | if (User?.get("name")) { |
| 81 | const sanitizename = generateTitleFromFilename(User?.get("name")); |
| 82 | const replaceSpace = sanitizeFileName(sanitizename); |
| 83 | setSignName(replaceSpace); |
| 84 | } |
| 85 | } |
| 86 | setIsLoader(false); |
| 87 | } catch (err) { |
| 88 | console.log("Err", err); |
| 89 | alert(`${err.message}`); |
| 90 | } |
| 91 | } |
| 92 | }; |
| 93 | const handleSignatureChange = () => { |
| 94 | if (imageRef.current) { |
| 95 | imageRef.current.value = ""; |
no test coverage detected