Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 12 additions & 39 deletions apps/OpenSign/src/layout/HomeLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,7 @@ const HomeLayout = () => {
const [isTour, setIsTour] = useState(false);
const [tourStatusArr, setTourStatusArr] = useState([]);
const [tourConfigs, setTourConfigs] = useState([]);
const [, setCookie] = useCookies([
"TenantId",
"userDetails",
"userEmail",
"profileImg",
"fev_Icon",
"accesstoken",
`Parse/${localStorage.getItem("parseAppId")}/currentUser`,
"appLogo",
"baseUrl",
"domain",
"parseAppId",
"username",
"main_Domain"
]);
const [, setCookie] = useCookies(["accesstoken", "main_Domain"]);

useEffect(() => {
(async () => {
Expand All @@ -65,33 +51,20 @@ const HomeLayout = () => {
}, []);
//function to use save data in cookies storage
const saveCookies = () => {
setCookie("TenantId", localStorage.getItem("TenantId"), { secure: true });
setCookie("userDetails", localStorage.getItem("userDetails"), {
secure: true
});
setCookie("userEmail", localStorage.getItem("userEmail"), { secure: true });
setCookie("profileImg", localStorage.getItem("profileImg"), {
secure: true
});
setCookie("fev_Icon", localStorage.getItem("fev_Icon"), { secure: true });
const main_Domain = window.location.origin;
const domainName = window.location.hostname; //app.opensignlabs.com
// Find the index of the first dot in the string
const indexOfFirstDot = domainName.indexOf(".");
// Remove the first dot and get the substring starting from the next character
const updateDomain = domainName.substring(indexOfFirstDot); //.opensignlabs.com
setCookie("accesstoken", localStorage.getItem("accesstoken"), {
secure: true
secure: true,
domain: updateDomain
});
setCookie(
`Parse/${localStorage.getItem("parseAppId")}/currentUser`,
localStorage.getItem(
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
),
{ secure: true }
);
setCookie("appLogo", localStorage.getItem("appLogo"), { secure: true });
setCookie("baseUrl", localStorage.getItem("baseUrl"), { secure: true });
setCookie("domain", localStorage.getItem("domain"), { secure: true });
setCookie("parseAppId", localStorage.getItem("parseAppId"), {
secure: true
setCookie("main_Domain", main_Domain, {
secure: true,
domain: updateDomain
});
setCookie("username", localStorage.getItem("username"), { secure: true });
setCookie("main_Domain", window.location.host, { secure: true });
};

async function checkIsSubscribed() {
Expand Down