mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-07 18:27:41 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56dd060531 | ||
|
|
960fbdb0eb |
@@ -49,6 +49,7 @@ const AddSigner = (props) => {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setIsLoader(true);
|
setIsLoader(true);
|
||||||
|
if (localStorage.getItem("TenantId")) {
|
||||||
try {
|
try {
|
||||||
const contactQuery = new Parse.Object("contracts_Contactbook");
|
const contactQuery = new Parse.Object("contracts_Contactbook");
|
||||||
contactQuery.set("Name", name);
|
contactQuery.set("Name", name);
|
||||||
@@ -56,13 +57,11 @@ const AddSigner = (props) => {
|
|||||||
contactQuery.set("Email", email);
|
contactQuery.set("Email", email);
|
||||||
contactQuery.set("UserRole", "contracts_Guest");
|
contactQuery.set("UserRole", "contracts_Guest");
|
||||||
|
|
||||||
if (localStorage.getItem("TenantId")) {
|
|
||||||
contactQuery.set("TenantId", {
|
contactQuery.set("TenantId", {
|
||||||
__type: "Pointer",
|
__type: "Pointer",
|
||||||
className: "partners_Tenant",
|
className: "partners_Tenant",
|
||||||
objectId: localStorage.getItem("TenantId")
|
objectId: localStorage.getItem("TenantId")
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const _users = Parse.Object.extend("User");
|
const _users = Parse.Object.extend("User");
|
||||||
@@ -188,6 +187,9 @@ const AddSigner = (props) => {
|
|||||||
setIsLoader(false);
|
setIsLoader(false);
|
||||||
alert("something went wrong!");
|
alert("something went wrong!");
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
alert('something went wrong, please try again later')
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define a function to handle the "add yourself" checkbox
|
// Define a function to handle the "add yourself" checkbox
|
||||||
|
|||||||
@@ -28,29 +28,34 @@ const HomeLayout = () => {
|
|||||||
const [tourConfigs, setTourConfigs] = useState([]);
|
const [tourConfigs, setTourConfigs] = useState([]);
|
||||||
const [, setCookie] = useCookies(["accesstoken", "main_Domain"]);
|
const [, setCookie] = useCookies(["accesstoken", "main_Domain"]);
|
||||||
|
|
||||||
|
const tenantId = localStorage.getItem("TenantId");
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
if (!tenantId) {
|
||||||
try {
|
setIsUserValid(false);
|
||||||
// Use the session token to validate the user
|
} else {
|
||||||
const userQuery = new Parse.Query(Parse.User);
|
(async () => {
|
||||||
const user = await userQuery.get(Parse.User.current().id, {
|
try {
|
||||||
sessionToken: localStorage.getItem("accesstoken")
|
// Use the session token to validate the user
|
||||||
});
|
const userQuery = new Parse.Query(Parse.User);
|
||||||
if (user) {
|
const user = await userQuery.get(Parse.User.current().id, {
|
||||||
localStorage.setItem("profileImg", user.get("ProfilePic") || "");
|
sessionToken: localStorage.getItem("accesstoken")
|
||||||
checkIsSubscribed();
|
});
|
||||||
} else {
|
if (user) {
|
||||||
|
localStorage.setItem("profileImg", user.get("ProfilePic") || "");
|
||||||
|
checkIsSubscribed();
|
||||||
|
} else {
|
||||||
|
setIsUserValid(false);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// Session token is invalid or there was an error
|
||||||
setIsUserValid(false);
|
setIsUserValid(false);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
})();
|
||||||
// Session token is invalid or there was an error
|
saveCookies();
|
||||||
setIsUserValid(false);
|
}
|
||||||
}
|
|
||||||
})();
|
|
||||||
saveCookies();
|
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, [tenantId]);
|
||||||
//function to use save data in cookies storage
|
//function to use save data in cookies storage
|
||||||
const saveCookies = () => {
|
const saveCookies = () => {
|
||||||
const main_Domain = window.location.origin;
|
const main_Domain = window.location.origin;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const Dashboard = () => {
|
|||||||
getDashboard(localStorage.getItem("PageLanding"));
|
getDashboard(localStorage.getItem("PageLanding"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
navigate("/", { replace: true, state: { from: location } });
|
navigate("/", { replace: true, state: { from: "" } });
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [id]);
|
}, [id]);
|
||||||
|
|||||||
Reference in New Issue
Block a user