fix: add comment

This commit is contained in:
RaktimaNXG
2024-05-29 18:56:17 +05:30
parent 33b0111ed0
commit 6b47f6a27b
3 changed files with 9 additions and 6 deletions
+3 -6
View File
@@ -30,7 +30,7 @@ function UserProfile() {
const [publicUserName, setPublicUserName] = useState(
extendUser && extendUser?.[0]?.UserName
);
const previousStateValueRef = useRef(publicUserName);
const previousPublicUserName = useRef(publicUserName);
const [company, setCompany] = useState(
extendUser && extendUser?.[0]?.Company
);
@@ -79,7 +79,7 @@ function UserProfile() {
}
}
};
//function to check public username already exist
const handleCheckPublicUserName = async () => {
try {
const res = await Parse.Cloud.run("getpublicusername", {
@@ -99,14 +99,11 @@ function UserProfile() {
};
const handleSubmit = async (e) => {
e.preventDefault();
let phn = Phone,
res;
if (previousStateValueRef.current !== publicUserName) {
if (previousPublicUserName.current !== publicUserName) {
res = await handleCheckPublicUserName();
}
if (!res) {
setIsLoader(true);
try {
@@ -754,18 +754,22 @@ const ReportTable = (props) => {
const handleViewSigners = (item) => {
setIsViewShare({ [item.objectId]: true });
};
//function to handle change template status is public or private
const handlePublicChange = async (e, item) => {
const getPlaceholder = item?.Placeholders;
//condiiton to check role is exist or not
if (getPlaceholder && getPlaceholder.length > 0) {
let extendUser = JSON.parse(localStorage.getItem("Extand_Class"));
const userName = extendUser[0]?.UserName;
setIsPublicUserName(extendUser[0]?.UserName);
//condition to check user have public url or not
if (userName) {
setIsPublic({ [item.objectId]: e.target.checked });
const getRole = [];
getPlaceholder.map((data) => {
getRole.push(data.Role);
});
//condiiton to handle role length if only one then set it default selected role
if (getRole.length === 1) {
setSelectedPublicRole(getRole[0]);
}
@@ -784,6 +788,7 @@ const ReportTable = (props) => {
}
};
//function to copy public profile link
const copytoProfileLink = () => {
const url = `https://opensign.me/${publicUserName}`;
copytoData(url);
@@ -4,6 +4,7 @@ async function GetPublicUserName(request) {
const userQuery = new Parse.Query('contracts_Users');
userQuery.equalTo('UserName', username);
const res = await userQuery.first({ useMasterKey: true });
return res;
} catch (err) {
return err;