Skip to content

Commit

Permalink
changed the action to apply
Browse files Browse the repository at this point in the history
  • Loading branch information
hridya-egov committed Aug 20, 2024
1 parent 6c3bd3c commit 50a873e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export const Complaint = {
user: user,
},
workflow: {
// action: "APPLY",
action: "APPLY",
// verificationDocuments: uploadedImages,
action: "CREATE", assignes: [], hrmsAssignes: [], comments: ""
//action: "CREATE", assignes: [], hrmsAssignes: [], comments: ""
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppContainer, BackButton ,Toast} from "@egovernments/digit-ui-components";
import { AppContainer, BackButton ,Toast} from "@egovernments/digit-ui-react-components";
import React, { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Route, Switch, useHistory, useLocation, useRouteMatch } from "react-router-dom";
Expand Down Expand Up @@ -62,8 +62,10 @@ const Login = ({ stateCode, isUserRegistered = true }) => {
errorTimeout && clearTimeout(errorTimeout);
};
}, [error]);
console.log('Context Path at render:', window?.contextPath);

useEffect(() => {
console.log('Context Path a:', window?.contextPath);
if (!user) {
return;
}
Expand Down Expand Up @@ -93,8 +95,10 @@ const Login = ({ stateCode, isUserRegistered = true }) => {
)
);

const getUserType = () => Digit.UserService.getType();

//const getUserType = () => Digit.UserService.getType();
const userType =
"citizen";
//console.log("User Type:", userType);
const handleOtpChange = (otp) => {
setParmas({ ...params, otp });
};
Expand All @@ -106,12 +110,14 @@ const Login = ({ stateCode, isUserRegistered = true }) => {

const selectMobileNumber = async (mobileNumber) => {
setCanSubmitNo(false);

setParmas({ ...params, ...mobileNumber });
const data = {
...mobileNumber,
tenantId: stateCode,
userType: getUserType(),
userType: userType,
};

if (isUserRegistered) {
const [res, err] = await sendOtp({ otp: { ...data, ...TYPE_LOGIN } });
if (!err) {
Expand All @@ -138,12 +144,12 @@ const Login = ({ stateCode, isUserRegistered = true }) => {
setCanSubmitNo(true);
}
};

console.log("path",path);
const selectName = async (name) => {
const data = {
...params,
tenantId: stateCode,
userType: getUserType(),
userType: userType,
...name,
};
setParmas({ ...params, ...name });
Expand All @@ -167,7 +173,7 @@ const Login = ({ stateCode, isUserRegistered = true }) => {
username: mobileNumber,
password: otp,
tenantId: stateCode,
userType: getUserType(),
userType: userType,
};
const { ResponseInfo, UserRequest: info, ...tokens } = await Digit.UserService.authenticate(requestData);

Expand Down Expand Up @@ -211,7 +217,7 @@ const Login = ({ stateCode, isUserRegistered = true }) => {
const data = {
mobileNumber,
tenantId: stateCode,
userType: getUserType(),
userType: userType(),
};
if (!isUserRegistered) {
const [res, err] = await sendOtp({ otp: { ...data, ...TYPE_REGISTER } });
Expand Down Expand Up @@ -243,14 +249,15 @@ const Login = ({ stateCode, isUserRegistered = true }) => {
onMobileChange={handleMobileChange}
canSubmit={canSubmitNo}
showRegisterLink={isUserRegistered && !location.state?.role}
className="card-header"
t={t}
/>
</Route>
</div>,
<div>
<Route path={`${path}/otp`}>
<SelectOtp
config={{ ...stepItems[1], texts: { ...stepItems[1].texts, cardText: `${stepItems[1].texts.cardText} ${params.mobileNumber || ""}` } }}
config={{ ...stepItems[1], texts: { ...stepItems[1].texts, cardText : `${stepItems[1].texts.cardText} ${params.mobileNumber || ""}` } }}
onOtpChange={handleOtpChange}
onResend={resendOtp}
onSelect={selectOtp}
Expand All @@ -270,7 +277,50 @@ const Login = ({ stateCode, isUserRegistered = true }) => {
</AppContainer>
</Switch>
</div>
);
);
// return (
// <div className="citizen-form-wrapper ">

// <Switch>
// <AppContainer>
// {/* <BackButton /> */}
// <Route path={`${path}`} exact>

// <div>
// <SelectMobileNumber
// onSelect={selectMobileNumber}
// config={stepItems[0]}
// mobileNumber={params.mobileNumber || ""}
// onMobileChange={handleMobileChange}
// canSubmit={canSubmitNo}
// showRegisterLink={isUserRegistered && !location.state?.role}
// t={t}
// />
// </div>

// </Route>
// <Route path={`${path}/otp`}>
// <SelectOtp
// config={{ ...stepItems[1], texts: { ...stepItems[1].texts, cardText : `${stepItems[1].texts.cardText} ${params.mobileNumber || ""}` },
// }}
// onOtpChange={handleOtpChange}
// onResend={resendOtp}
// onSelect={selectOtp}
// otp={params.otp}
// error={isOtpValid}
// canSubmit={canSubmitOtp}
// t={t}
// />
// </Route>
// <Route path={`${path}/name`}>
// <SelectName config={stepItems[2]} onSelect={selectName} t={t} isDisabled={canSubmitName} />
// </Route>
// {/* {error && <Toast type={"error"} label={error} onClose={() => setError(null)} />} */}
// {error && <Toast type={"error"} label={error} onClose={() => setError(null)} />}
// </AppContainer>
// </Switch>
// </div>
// );
};

export default Login;

0 comments on commit 50a873e

Please sign in to comment.