MCPcopy Create free account
hub / github.com/OpenSignLabs/OpenSign / handleSubmitbtn

Function handleSubmitbtn

apps/OpenSign/src/pages/Login.jsx:281–324  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

279 };
280
281 const handleSubmitbtn = async (e) => {
282 e.preventDefault();
283 if (userDetails.Destination && userDetails.Company) {
284 setThirdpartyLoader(true);
285 const payload = { sessionToken: localStorage.getItem("accesstoken") };
286 const userInformation = JSON.parse(
287 localStorage.getItem("UserInformation")
288 );
289 if (payload && payload.sessionToken) {
290 const params = {
291 userDetails: {
292 name: userInformation.name,
293 email: userInformation.email,
294 phone: userInformation?.phone || "",
295 role: "contracts_User",
296 company: userDetails.Company,
297 jobTitle: userDetails.Destination,
298 timezone: usertimezone
299 }
300 };
301 const userSignUp = await Parse.Cloud.run("usersignup", params);
302 if (userSignUp && userSignUp.sessionToken) {
303 const LocalUserDetails = {
304 name: userInformation.name,
305 email: userInformation.email,
306 phone: userInformation?.phone || "",
307 company: userDetails.Company,
308 jobTitle: userDetails.JobTitle
309 };
310 localStorage.setItem("userDetails", JSON.stringify(LocalUserDetails));
311 thirdpartyLoginfn(userSignUp.sessionToken);
312 } else {
313 alert(userSignUp.message);
314 }
315 } else if (
316 payload &&
317 payload.message.replace(/ /g, "_") === "Internal_server_err"
318 ) {
319 alert(t("server-error"));
320 }
321 } else {
322 showToast("warning", t("fill-required-details!"));
323 }
324 };
325
326 const logOutUser = async () => {
327 setIsModal(false);

Callers 2

thirdpartyLoginfnFunction · 0.85
LoginFunction · 0.85

Calls 3

setThirdpartyLoaderFunction · 0.85
thirdpartyLoginfnFunction · 0.85
showToastFunction · 0.70

Tested by

no test coverage detected