mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-20 14:42:37 +02:00
Merge pull request #508 from OpenSignLabs/migrate_redux
This commit is contained in:
Generated
+30
-53
@@ -36,7 +36,7 @@
|
||||
"react-konva": "^18.2.10",
|
||||
"react-modal": "^3.16.1",
|
||||
"react-pdf": "^7.7.1",
|
||||
"react-redux": "^8.1.3",
|
||||
"react-redux": "^9.1.0",
|
||||
"react-rnd": "^10.4.1",
|
||||
"react-router-dom": "^6.22.3",
|
||||
"react-scripts": "5.0.1",
|
||||
@@ -45,8 +45,8 @@
|
||||
"react-signature-canvas": "^1.0.6",
|
||||
"react-tooltip": "^5.26.3",
|
||||
"reactour": "^1.19.2",
|
||||
"redux": "^4.2.1",
|
||||
"redux-thunk": "^2.4.2",
|
||||
"redux": "^5.0.1",
|
||||
"redux-thunk": "^3.1.0",
|
||||
"regex-parser": "^2.3.0",
|
||||
"serve": "^14.2.1",
|
||||
"styled-components": "^4.4.1",
|
||||
@@ -5560,19 +5560,6 @@
|
||||
"url": "https://opencollective.com/immer"
|
||||
}
|
||||
},
|
||||
"node_modules/@reduxjs/toolkit/node_modules/redux": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
|
||||
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w=="
|
||||
},
|
||||
"node_modules/@reduxjs/toolkit/node_modules/redux-thunk": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
|
||||
"integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",
|
||||
"peerDependencies": {
|
||||
"redux": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@remix-run/router": {
|
||||
"version": "1.15.3",
|
||||
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.3.tgz",
|
||||
@@ -6122,6 +6109,8 @@
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.3.tgz",
|
||||
"integrity": "sha512-Wny3a2UXn5FEA1l7gc6BbpoV5mD1XijZqgkp4TRgDCDL5r3B5ieOFGUX5h3n78Tr1MEG7BfvoM8qeztdvNU0fw==",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/react": "*",
|
||||
"hoist-non-react-statics": "^3.3.0"
|
||||
@@ -9662,6 +9651,14 @@
|
||||
"redux": "^4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dnd-core/node_modules/redux": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz",
|
||||
"integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.2"
|
||||
}
|
||||
},
|
||||
"node_modules/dnd-multi-backend": {
|
||||
"version": "8.0.3",
|
||||
"resolved": "https://registry.npmjs.org/dnd-multi-backend/-/dnd-multi-backend-8.0.3.tgz",
|
||||
@@ -11264,9 +11261,9 @@
|
||||
"integrity": "sha512-bHWEmjLsTjGP9gVs7P3Hyl+oY5NlMW8aTSPdTJ+X2GKt6glDctt9fUCLbRV+d/l8NDC40+FxMjp9WlTQXaQALw=="
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.5",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz",
|
||||
"integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==",
|
||||
"version": "1.15.6",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
||||
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
@@ -19823,35 +19820,23 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react-redux": {
|
||||
"version": "8.1.3",
|
||||
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.1.3.tgz",
|
||||
"integrity": "sha512-n0ZrutD7DaX/j9VscF+uTALI3oUPa/pO4Z3soOBIjuRn/FzVu6aehhysxZCLi6y7duMf52WNZGMl7CtuK5EnRw==",
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.1.0.tgz",
|
||||
"integrity": "sha512-6qoDzIO+gbrza8h3hjMA9aq4nwVFCKFtY2iLxCtVT38Swyy2C/dJCGBXHeHLtx6qlg/8qzc2MrhOeduf5K32wQ==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.1",
|
||||
"@types/hoist-non-react-statics": "^3.3.1",
|
||||
"@types/use-sync-external-store": "^0.0.3",
|
||||
"hoist-non-react-statics": "^3.3.2",
|
||||
"react-is": "^18.0.0",
|
||||
"use-sync-external-store": "^1.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^16.8 || ^17.0 || ^18.0",
|
||||
"@types/react-dom": "^16.8 || ^17.0 || ^18.0",
|
||||
"react": "^16.8 || ^17.0 || ^18.0",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0",
|
||||
"react-native": ">=0.59",
|
||||
"redux": "^4 || ^5.0.0-beta.0"
|
||||
"@types/react": "^18.2.25",
|
||||
"react": "^18.0",
|
||||
"react-native": ">=0.69",
|
||||
"redux": "^5.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
},
|
||||
"react-dom": {
|
||||
"optional": true
|
||||
},
|
||||
"react-native": {
|
||||
"optional": true
|
||||
},
|
||||
@@ -19860,11 +19845,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/react-redux/node_modules/react-is": {
|
||||
"version": "18.2.0",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
|
||||
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
|
||||
},
|
||||
"node_modules/react-refresh": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
|
||||
@@ -20271,19 +20251,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/redux": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz",
|
||||
"integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.2"
|
||||
}
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
|
||||
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w=="
|
||||
},
|
||||
"node_modules/redux-thunk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.4.2.tgz",
|
||||
"integrity": "sha512-+P3TjtnP0k/FEjcBL5FZpoovtvrTNT/UXd4/sluaSyrURlSlhLSzEdfsTBW7WsKB6yPvgd7q/iZPICFjW4o57Q==",
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
|
||||
"integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",
|
||||
"peerDependencies": {
|
||||
"redux": "^4"
|
||||
"redux": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/reflect.getprototypeof": {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"react-konva": "^18.2.10",
|
||||
"react-modal": "^3.16.1",
|
||||
"react-pdf": "^7.7.1",
|
||||
"react-redux": "^8.1.3",
|
||||
"react-redux": "^9.1.0",
|
||||
"react-rnd": "^10.4.1",
|
||||
"react-router-dom": "^6.22.3",
|
||||
"react-scripts": "5.0.1",
|
||||
@@ -40,8 +40,8 @@
|
||||
"react-signature-canvas": "^1.0.6",
|
||||
"react-tooltip": "^5.26.3",
|
||||
"reactour": "^1.19.2",
|
||||
"redux": "^4.2.1",
|
||||
"redux-thunk": "^2.4.2",
|
||||
"redux": "^5.0.1",
|
||||
"redux-thunk": "^3.1.0",
|
||||
"regex-parser": "^2.3.0",
|
||||
"serve": "^14.2.1",
|
||||
"styled-components": "^4.4.1",
|
||||
|
||||
@@ -15,6 +15,7 @@ import SignYourSelf from "./pages/SignyourselfPdf";
|
||||
import DraftDocument from "./components/pdf/DraftDocument";
|
||||
import PlaceHolderSign from "./pages/PlaceHolderSign";
|
||||
import PdfRequestFiles from "./pages/PdfRequestFiles";
|
||||
import Opensigndrive from "./pages/Opensigndrive";
|
||||
const DebugPdf = lazy(() => import("./pages/DebugPdf"));
|
||||
const ForgetPassword = lazy(() => import("./pages/ForgetPassword"));
|
||||
const GuestLogin = lazy(() => import("./pages/GuestLogin"));
|
||||
@@ -25,7 +26,6 @@ const UserProfile = lazy(() => import("./pages/UserProfile"));
|
||||
const Signup = lazy(() => import("./pages/Signup"));
|
||||
const GenerateToken = lazy(() => import("./pages/GenerateToken"));
|
||||
const Webhook = lazy(() => import("./pages/Webhook"));
|
||||
const Opensigndrive = lazy(() => import("./pages/Opensigndrive"));
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
|
||||
|
||||
const Loader = () => {
|
||||
|
||||
@@ -10,7 +10,7 @@ const Menu = ({ item, isOpen, closeSidebar }) => {
|
||||
? `/${item.pageType}/${item.objectId}`
|
||||
: `/${item.objectId}`
|
||||
}
|
||||
className="mx-auto flex items-center hover:bg-[#eef1f5] p-3 lg:p-4 cursor-pointer"
|
||||
className="mx-auto flex items-center hover:bg-[#eef1f5] p-3 lg:p-4 cursor-pointer focus:text-[#0056b3] focus:bg-[#eef1f5]"
|
||||
onClick={closeSidebar}
|
||||
tabIndex={isOpen ? 0 : -1}
|
||||
role="menuitem"
|
||||
|
||||
@@ -13,7 +13,7 @@ const Submenu = ({ item, closeSidebar }) => {
|
||||
<li role="none">
|
||||
<button
|
||||
onClick={toggleSubmenu}
|
||||
className="w-full flex items-center text-left text-[#444] p-3 lg:p-4 hover:bg-[#eef1f5] focus:ring-2 focus:ring-blue-600"
|
||||
className="w-full flex items-center text-left text-[#444] p-3 lg:p-4 hover:bg-[#eef1f5] focus:outline-none focus:text-[#0056b3] focus:bg-[#eef1f5]"
|
||||
aria-expanded={submenuOpen}
|
||||
aria-haspopup="true"
|
||||
aria-controls={`submenu-${title}`}
|
||||
@@ -39,7 +39,7 @@ const Submenu = ({ item, closeSidebar }) => {
|
||||
? `/${childItem.pageType}/${childItem.objectId}`
|
||||
: `/${childItem.objectId}`
|
||||
}
|
||||
className="block pl-6 md:pl-8 py-2 text-sm text-gray-700 hover:bg-blue-500 hover:text-white cursor-pointer"
|
||||
className="block pl-6 md:pl-8 py-2 text-sm text-gray-700 hover:bg-blue-500 hover:text-white focus:text-[#0056b3] focus:bg-[#eef1f5] cursor-pointer"
|
||||
onClick={closeSidebar}
|
||||
role="menuitem"
|
||||
tabIndex={submenuOpen ? 0 : -1}
|
||||
|
||||
@@ -4,10 +4,11 @@ import "../styles/loader.css";
|
||||
import GetDashboard from "../components/dashboard/GetDashboard";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import Title from "../components/Title";
|
||||
import { save_tourSteps } from "../redux/actions";
|
||||
import { connect } from "react-redux";
|
||||
const Dashboard = (props) => {
|
||||
import { useDispatch } from "react-redux";
|
||||
import { saveTourSteps } from "../redux/reducers/TourStepsReducer";
|
||||
const Dashboard = () => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const { id } = useParams();
|
||||
const [dashboard, setdashboard] = useState([]);
|
||||
const [classnameArray, setclassnameArray] = useState([]);
|
||||
@@ -88,7 +89,7 @@ const Dashboard = (props) => {
|
||||
// style: { backgroundColor: "#abd4d2" },
|
||||
};
|
||||
});
|
||||
props.save_tourSteps(arr);
|
||||
dispatch(saveTourSteps(arr));
|
||||
// console.log("arr ", arr);
|
||||
setclassnameArray(classArray);
|
||||
if (localStorage.getItem("DashboardDefaultFilter")) {
|
||||
@@ -133,6 +134,4 @@ const Dashboard = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default connect(null, {
|
||||
save_tourSteps
|
||||
})(Dashboard);
|
||||
export default Dashboard;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { fetchAppInfo, forgetPassword } from "../redux/actions";
|
||||
import Title from "../components/Title";
|
||||
import { NavLink } from "react-router-dom";
|
||||
import login_img from "../assets/images/login_img.svg";
|
||||
import Parse from "parse";
|
||||
import Alert from "../primitives/Alert";
|
||||
function ForgotPassword(props) {
|
||||
import { appInfo } from "../constant/appinfo";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { fetchAppInfo } from "../redux/reducers/infoReducer";
|
||||
|
||||
function ForgotPassword() {
|
||||
const dispatch = useDispatch();
|
||||
const [state, setState] = useState({
|
||||
email: "",
|
||||
password: "",
|
||||
@@ -27,14 +30,11 @@ function ForgotPassword(props) {
|
||||
|
||||
const handleSubmit = async (event) => {
|
||||
event.preventDefault();
|
||||
localStorage.setItem("appLogo", props.appInfo.applogo);
|
||||
localStorage.setItem("appName", props.appInfo.appname);
|
||||
localStorage.setItem("defaultmenuid", props.appInfo.defaultmenuid);
|
||||
localStorage.setItem("PageLanding", props.appInfo.LandingPageId);
|
||||
localStorage.setItem(
|
||||
"userSettings",
|
||||
JSON.stringify(props.appInfo.settings)
|
||||
);
|
||||
localStorage.setItem("appLogo", appInfo.applogo);
|
||||
localStorage.setItem("appName", appInfo.appname);
|
||||
// localStorage.setItem("defaultmenuid", props.appInfo.defaultmenuid);
|
||||
// localStorage.setItem("PageLanding", props.appInfo.LandingPageId);
|
||||
localStorage.setItem("userSettings", JSON.stringify(appInfo.settings));
|
||||
if (state.email) {
|
||||
const username = state.email;
|
||||
try {
|
||||
@@ -50,14 +50,14 @@ function ForgotPassword(props) {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
props.fetchAppInfo();
|
||||
dispatch(fetchAppInfo());
|
||||
resize();
|
||||
window.addEventListener("resize", resize);
|
||||
return () => window.removeEventListener("resize", resize);
|
||||
// eslint-disable-next-line
|
||||
}, []);
|
||||
|
||||
let image = props.appInfo.applogo;
|
||||
let image = appInfo.applogo;
|
||||
return (
|
||||
<div className="bg-white">
|
||||
<Title title="Forgot password page" />
|
||||
@@ -129,10 +129,4 @@ function ForgotPassword(props) {
|
||||
);
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return { appInfo: state.appInfo, forgotPassword: state.forgotPassword };
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, { fetchAppInfo, forgetPassword })(
|
||||
ForgotPassword
|
||||
);
|
||||
export default ForgotPassword;
|
||||
|
||||
+110
-121
@@ -1,8 +1,7 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Parse from "parse";
|
||||
import "../styles/loader.css";
|
||||
import { connect } from "react-redux";
|
||||
import { fetchAppInfo, showTenantName } from "../redux/actions";
|
||||
import { useDispatch } from "react-redux";
|
||||
import axios from "axios";
|
||||
import Title from "../components/Title";
|
||||
import GoogleSignInBtn from "../components/LoginGoogle";
|
||||
@@ -13,10 +12,13 @@ import { useWindowSize } from "../hook/useWindowSize";
|
||||
import ModalUi from "../primitives/ModalUi";
|
||||
import { modalCancelBtnColor, modalSubmitBtnColor } from "../constant/const";
|
||||
import Alert from "../primitives/Alert";
|
||||
|
||||
function Login(props) {
|
||||
import { appInfo } from "../constant/appinfo";
|
||||
import { fetchAppInfo } from "../redux/reducers/infoReducer";
|
||||
import { showTenant } from "../redux/reducers/ShowTenant";
|
||||
function Login() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const dispatch = useDispatch();
|
||||
const { width } = useWindowSize();
|
||||
const [state, setState] = useState({
|
||||
email: "",
|
||||
@@ -37,14 +39,14 @@ function Login(props) {
|
||||
Destination: ""
|
||||
});
|
||||
const [isModal, setIsModal] = useState(false);
|
||||
const image = props?.appInfo?.applogo || undefined;
|
||||
const image = appInfo?.applogo || undefined;
|
||||
|
||||
useEffect(() => {
|
||||
if (localStorage.getItem("accesstoken")) {
|
||||
setState({ ...state, loading: true });
|
||||
GetLoginData();
|
||||
}
|
||||
props.fetchAppInfo();
|
||||
dispatch(fetchAppInfo());
|
||||
// eslint-disable-next-line
|
||||
}, []);
|
||||
const handleChange = (event) => {
|
||||
@@ -61,8 +63,8 @@ function Login(props) {
|
||||
setState({ ...state, loading: true });
|
||||
let baseUrl = localStorage.getItem("baseUrl");
|
||||
let parseAppId = localStorage.getItem("parseAppId");
|
||||
localStorage.setItem("appLogo", props.appInfo.applogo);
|
||||
localStorage.setItem("appName", props.appInfo.appname);
|
||||
localStorage.setItem("appLogo", appInfo.applogo);
|
||||
localStorage.setItem("appName", appInfo.appname);
|
||||
// Pass the username and password to logIn function
|
||||
await Parse.User.logIn(email, password)
|
||||
.then(async (user) => {
|
||||
@@ -81,8 +83,8 @@ function Login(props) {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
let userRoles = [];
|
||||
if (props.appInfo.settings) {
|
||||
let userSettings = props.appInfo.settings;
|
||||
if (appInfo.settings) {
|
||||
let userSettings = appInfo.settings;
|
||||
|
||||
//Get Current user roles
|
||||
let url = `${baseUrl}functions/UserGroups`;
|
||||
@@ -172,8 +174,10 @@ function Login(props) {
|
||||
}
|
||||
});
|
||||
if (tenentInfo.length) {
|
||||
props.showTenantName(
|
||||
tenentInfo[0].tenentName || ""
|
||||
dispatch(
|
||||
showTenant(
|
||||
tenentInfo[0].tenentName || ""
|
||||
)
|
||||
);
|
||||
localStorage.setItem(
|
||||
"TenantName",
|
||||
@@ -212,8 +216,10 @@ function Login(props) {
|
||||
}
|
||||
});
|
||||
if (tenentInfo.length) {
|
||||
props.showTenantName(
|
||||
tenentInfo[0].tenentName || ""
|
||||
dispatch(
|
||||
showTenant(
|
||||
tenentInfo[0].tenentName || ""
|
||||
)
|
||||
);
|
||||
localStorage.setItem(
|
||||
"TenantName",
|
||||
@@ -412,8 +418,8 @@ function Login(props) {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
let userRoles = [];
|
||||
if (props.appInfo.settings) {
|
||||
let userSettings = props.appInfo.settings;
|
||||
if (appInfo.settings) {
|
||||
let userSettings = appInfo.settings;
|
||||
|
||||
//Get Current user roles
|
||||
let url = `${baseUrl}functions/UserGroups`;
|
||||
@@ -503,8 +509,8 @@ function Login(props) {
|
||||
}
|
||||
});
|
||||
if (tenentInfo.length) {
|
||||
props.showTenantName(
|
||||
tenentInfo[0].tenentName || ""
|
||||
dispatch(
|
||||
showTenant(tenentInfo[0].tenentName || "")
|
||||
);
|
||||
localStorage.setItem(
|
||||
"TenantName",
|
||||
@@ -543,8 +549,8 @@ function Login(props) {
|
||||
}
|
||||
});
|
||||
if (tenentInfo.length) {
|
||||
props.showTenantName(
|
||||
tenentInfo[0].tenentName || ""
|
||||
dispatch(
|
||||
showTenant(tenentInfo[0].tenentName || "")
|
||||
);
|
||||
localStorage.setItem(
|
||||
"TenantName",
|
||||
@@ -730,94 +736,90 @@ function Login(props) {
|
||||
} else {
|
||||
_currentRole = userRoles[0];
|
||||
}
|
||||
let SettingsUser = JSON.parse(userSettings);
|
||||
SettingsUser.forEach(async (element) => {
|
||||
if (element.role === _currentRole) {
|
||||
let _role = _currentRole.replace(
|
||||
`${localStorage.getItem("_appName")}_`,
|
||||
""
|
||||
);
|
||||
localStorage.setItem("_user_role", _role);
|
||||
|
||||
// Get TenentID from Extendend Class
|
||||
localStorage.setItem(
|
||||
"extended_class",
|
||||
element.extended_class
|
||||
);
|
||||
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
}).then(
|
||||
(result) => {
|
||||
let tenentInfo = [];
|
||||
const results = [result];
|
||||
if (results) {
|
||||
let extendedInfo_stringify = JSON.stringify(results);
|
||||
let extendedInfo = JSON.parse(extendedInfo_stringify);
|
||||
if (extendedInfo.length > 1) {
|
||||
extendedInfo.forEach((x) => {
|
||||
if (x.TenantId) {
|
||||
let obj = {
|
||||
tenentId: x.TenantId.objectId,
|
||||
tenentName: x.TenantId.TenantName || ""
|
||||
};
|
||||
tenentInfo.push(obj);
|
||||
}
|
||||
});
|
||||
|
||||
localStorage.setItem("showpopup", true);
|
||||
localStorage.setItem("PageLanding", element.pageId);
|
||||
localStorage.setItem("defaultmenuid", element.menuId);
|
||||
localStorage.setItem("pageType", element.pageType);
|
||||
navigate("/");
|
||||
if (_currentRole && _currentRole !== "contracts_Guest") {
|
||||
let SettingsUser = JSON.parse(userSettings);
|
||||
SettingsUser.forEach(async (item) => {
|
||||
if (item.role === _currentRole) {
|
||||
let _role = _currentRole.replace(`${appInfo.appname}_`, "");
|
||||
localStorage.setItem("_user_role", _role);
|
||||
// Get TenentID from Extendend Class
|
||||
localStorage.setItem("extended_class", item.extended_class);
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
}).then(
|
||||
(result) => {
|
||||
let tenentInfo = [];
|
||||
const results = [result];
|
||||
if (results) {
|
||||
let extendedInfo_stringify = JSON.stringify(results);
|
||||
let extendedInfo = JSON.parse(extendedInfo_stringify);
|
||||
if (extendedInfo.length > 1) {
|
||||
extendedInfo.forEach((x) => {
|
||||
if (x.TenantId) {
|
||||
let obj = {
|
||||
tenentId: x.TenantId.objectId,
|
||||
tenentName: x.TenantId.TenantName || ""
|
||||
};
|
||||
tenentInfo.push(obj);
|
||||
}
|
||||
});
|
||||
localStorage.setItem("showpopup", true);
|
||||
localStorage.setItem("PageLanding", item.pageId);
|
||||
localStorage.setItem("defaultmenuid", item.menuId);
|
||||
localStorage.setItem("pageType", item.pageType);
|
||||
navigate("/");
|
||||
} else {
|
||||
extendedInfo.forEach((x) => {
|
||||
if (x.TenantId) {
|
||||
let obj = {
|
||||
tenentId: x.TenantId.objectId,
|
||||
tenentName: x.TenantId.TenantName || ""
|
||||
};
|
||||
localStorage.setItem(
|
||||
"TenetId",
|
||||
x.TenantId.objectId
|
||||
);
|
||||
tenentInfo.push(obj);
|
||||
}
|
||||
});
|
||||
localStorage.setItem("PageLanding", item.pageId);
|
||||
localStorage.setItem("defaultmenuid", item.menuId);
|
||||
localStorage.setItem("pageType", item.pageType);
|
||||
navigate(`/${item.pageType}/${item.pageId}`);
|
||||
}
|
||||
} else {
|
||||
extendedInfo.forEach((x) => {
|
||||
if (x.TenantId) {
|
||||
let obj = {
|
||||
tenentId: x.TenantId.objectId,
|
||||
tenentName: x.TenantId.TenantName || ""
|
||||
};
|
||||
localStorage.setItem(
|
||||
"TenetId",
|
||||
x.TenantId.objectId
|
||||
);
|
||||
tenentInfo.push(obj);
|
||||
}
|
||||
});
|
||||
localStorage.setItem("PageLanding", element.pageId);
|
||||
localStorage.setItem("defaultmenuid", element.menuId);
|
||||
localStorage.setItem("pageType", element.pageType);
|
||||
navigate(`/${element.pageType}/${element.pageId}`);
|
||||
localStorage.setItem("PageLanding", item.pageId);
|
||||
localStorage.setItem("defaultmenuid", item.menuId);
|
||||
localStorage.setItem("pageType", item.pageType);
|
||||
navigate(`/${item.pageType}/${item.pageId}`);
|
||||
}
|
||||
} else {
|
||||
localStorage.setItem("PageLanding", element.pageId);
|
||||
localStorage.setItem("defaultmenuid", element.menuId);
|
||||
localStorage.setItem("pageType", element.pageType);
|
||||
navigate(`/${element.pageType}/${element.pageId}`);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
setState({
|
||||
...state,
|
||||
loading: false,
|
||||
alertType: "danger",
|
||||
alertMsg: "You don`t have access to this application!"
|
||||
});
|
||||
setTimeout(function () {
|
||||
},
|
||||
(error) => {
|
||||
setState({
|
||||
...state,
|
||||
loading: false,
|
||||
alertType: "danger",
|
||||
alertMsg: ""
|
||||
alertMsg: "You don`t have access to this application!"
|
||||
});
|
||||
}, 2000);
|
||||
localStorage.setItem("accesstoken", null);
|
||||
console.error("Error while fetching Follow", error);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
setTimeout(function () {
|
||||
setState({
|
||||
...state,
|
||||
loading: false,
|
||||
alertType: "danger",
|
||||
alertMsg: ""
|
||||
});
|
||||
}, 2000);
|
||||
localStorage.setItem("accesstoken", null);
|
||||
console.error("Error while fetching Follow", error);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setState({ ...state, loading: false });
|
||||
handleCloseModal();
|
||||
}
|
||||
} else {
|
||||
console.log("User Role Not Found.");
|
||||
}
|
||||
@@ -943,7 +945,7 @@ function Login(props) {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{props.isloginVisible && props.isloginVisible ? (
|
||||
{appInfo && appInfo.appId ? (
|
||||
<>
|
||||
<div aria-labelledby="loginHeading" role="region">
|
||||
<div className="md:m-10 lg:m-16 md:p-4 lg:p-10 p-4 bg-[#ffffff] md:border-[1px] md:border-gray-400 ">
|
||||
@@ -1051,7 +1053,7 @@ function Login(props) {
|
||||
</div>
|
||||
</form>
|
||||
<br />
|
||||
{(props.appInfo.fbAppId || props.appInfo.googleClietId) && (
|
||||
{(appInfo.fbAppId || appInfo.googleClietId) && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
@@ -1082,9 +1084,9 @@ function Login(props) {
|
||||
justifyContent: "center"
|
||||
}}
|
||||
>
|
||||
{/* {props.appInfo.fbAppId && props.appInfo.fbAppId !== "" ? (
|
||||
{/* {appInfo.fbAppId && appInfo.fbAppId !== "" ? (
|
||||
<LoginFacebook
|
||||
FBCred={props.appInfo.fbAppId}
|
||||
FBCred={appInfo.fbAppId}
|
||||
thirdpartyLoginfn={thirdpartyLoginfn}
|
||||
thirdpartyLoader={state.thirdpartyLoader}
|
||||
setThirdpartyLoader={setThirdpartyLoader}
|
||||
@@ -1100,10 +1102,9 @@ function Login(props) {
|
||||
justifyContent: "center"
|
||||
}}
|
||||
>
|
||||
{props.appInfo.googleClietId &&
|
||||
props.appInfo.googleClietId !== "" ? (
|
||||
{appInfo.googleClietId && appInfo.googleClietId !== "" ? (
|
||||
<GoogleSignInBtn
|
||||
GoogleCred={props.appInfo.googleClietId}
|
||||
GoogleCred={appInfo.googleClietId}
|
||||
thirdpartyLoginfn={thirdpartyLoginfn}
|
||||
thirdpartyLoader={state.thirdpartyLoader}
|
||||
setThirdpartyLoader={setThirdpartyLoader}
|
||||
@@ -1213,16 +1214,4 @@ function Login(props) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
if (Object.keys(state.appInfo).length !== 0) {
|
||||
return { appInfo: state.appInfo, isloginVisible: true };
|
||||
} else {
|
||||
return { appInfo: state.appInfo, isloginVisible: false };
|
||||
}
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, {
|
||||
fetchAppInfo,
|
||||
showTenantName
|
||||
})(Login);
|
||||
export default Login;
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
import React, { useEffect, useState, useRef } from "react";
|
||||
import "../styles/opensigndrive.css";
|
||||
import loader from "../assets/images/loader2.gif";
|
||||
import DriveBody from "../components/opensigndrive/DriveBody";
|
||||
import { themeColor, iconColor } from "../constant/const";
|
||||
import { getDrive } from "../constant/Utils";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import Title from "../components/Title";
|
||||
import Parse from "parse";
|
||||
import ModalUi from "../primitives/ModalUi";
|
||||
|
||||
const DriveBody = React.lazy(() =>
|
||||
import("../components/opensigndrive/DriveBody")
|
||||
);
|
||||
const Loader = () => {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center"
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
fontSize: "45px",
|
||||
color: "#3dd3e0"
|
||||
}}
|
||||
className="loader-37"
|
||||
></div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
function Opensigndrive() {
|
||||
const navigate = useNavigate();
|
||||
const scrollRef = useRef(null);
|
||||
@@ -734,18 +755,20 @@ function Opensigndrive() {
|
||||
<span style={{ fontWeight: "bold" }}>No Data Found!</span>
|
||||
</div>
|
||||
) : (
|
||||
<DriveBody
|
||||
pdfData={pdfData}
|
||||
setFolderName={setFolderName}
|
||||
setIsLoading={setIsLoading}
|
||||
setDocId={setDocId}
|
||||
getPdfFolderDocumentList={getPdfFolderDocumentList}
|
||||
getPdfDocumentList={getPdfDocumentList}
|
||||
isDocId={docId}
|
||||
setPdfData={setPdfData}
|
||||
isList={isList}
|
||||
setIsAlert={setIsAlert}
|
||||
/>
|
||||
<React.Suspense fallback={<Loader />}>
|
||||
<DriveBody
|
||||
pdfData={pdfData}
|
||||
setFolderName={setFolderName}
|
||||
setIsLoading={setIsLoading}
|
||||
setDocId={setDocId}
|
||||
getPdfFolderDocumentList={getPdfFolderDocumentList}
|
||||
getPdfDocumentList={getPdfDocumentList}
|
||||
isDocId={docId}
|
||||
setPdfData={setPdfData}
|
||||
isList={isList}
|
||||
setIsAlert={setIsAlert}
|
||||
/>
|
||||
</React.Suspense>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -2,14 +2,17 @@ import React, { useState, useEffect } from "react";
|
||||
import "../styles/pgsignup.css";
|
||||
import Parse from "parse";
|
||||
import axios from "axios";
|
||||
import { fetchAppInfo, showTenantName } from "../redux/actions/index";
|
||||
import { connect } from "react-redux";
|
||||
import { useDispatch } from "react-redux";
|
||||
import Title from "../components/Title";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
import { appInfo } from "../constant/appinfo";
|
||||
import { showTenant } from "../redux/reducers/ShowTenant";
|
||||
import { fetchAppInfo } from "../redux/reducers/infoReducer";
|
||||
|
||||
const PgSignUp = (props) => {
|
||||
const PgSignUp = () => {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const dispatch = useDispatch();
|
||||
const [parseBaseUrl] = useState(localStorage.getItem("baseUrl"));
|
||||
const [parseAppId] = useState(localStorage.getItem("parseAppId"));
|
||||
const [formData, setFormData] = useState({
|
||||
@@ -24,8 +27,7 @@ const PgSignUp = (props) => {
|
||||
|
||||
// below useEffect is used to fetch App data and save to redux state
|
||||
useEffect(() => {
|
||||
// Parse.User.logOut()
|
||||
props.fetchAppInfo();
|
||||
dispatch(fetchAppInfo());
|
||||
handleSignedUpUser();
|
||||
// eslint-disable-next-line
|
||||
}, []);
|
||||
@@ -243,8 +245,8 @@ const PgSignUp = (props) => {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
let userRoles = [];
|
||||
if (props.appInfo.settings) {
|
||||
let userSettings = props.appInfo.settings;
|
||||
if (appInfo.settings) {
|
||||
let userSettings = appInfo.settings;
|
||||
|
||||
//Get Current user roles
|
||||
let url = `${baseUrl}functions/UserGroups`;
|
||||
@@ -319,8 +321,8 @@ const PgSignUp = (props) => {
|
||||
}
|
||||
});
|
||||
if (tenentInfo.length) {
|
||||
props.showTenantName(
|
||||
tenentInfo[0].tenentName || ""
|
||||
dispatch(
|
||||
showTenant(tenentInfo[0].tenentName || "")
|
||||
);
|
||||
localStorage.setItem(
|
||||
"TenantName",
|
||||
@@ -358,8 +360,8 @@ const PgSignUp = (props) => {
|
||||
}
|
||||
});
|
||||
if (tenentInfo.length) {
|
||||
props.showTenantName(
|
||||
tenentInfo[0].tenentName || ""
|
||||
dispatch(
|
||||
showTenant(tenentInfo[0].tenentName || "")
|
||||
);
|
||||
localStorage.setItem(
|
||||
"TenantName",
|
||||
@@ -537,15 +539,4 @@ const PgSignUp = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
if (Object.keys(state.appInfo).length !== 0) {
|
||||
return { appInfo: state.appInfo, isloginVisible: true };
|
||||
} else {
|
||||
return { appInfo: state.appInfo, isloginVisible: false };
|
||||
}
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, {
|
||||
fetchAppInfo,
|
||||
showTenantName
|
||||
})(PgSignUp);
|
||||
export default PgSignUp;
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import Parse from "parse";
|
||||
import axios from "axios";
|
||||
import Title from "../components/Title";
|
||||
import { fetchAppInfo, showTenantName } from "../redux/actions";
|
||||
import { useNavigate, NavLink } from "react-router-dom";
|
||||
import login_img from "../assets/images/login_img.svg";
|
||||
import { useWindowSize } from "../hook/useWindowSize";
|
||||
import Alert from "../primitives/Alert";
|
||||
|
||||
const Signup = (props) => {
|
||||
import { appInfo } from "../constant/appinfo";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { fetchAppInfo } from "../redux/reducers/infoReducer";
|
||||
import { showTenant } from "../redux/reducers/ShowTenant";
|
||||
const Signup = () => {
|
||||
const { width } = useWindowSize();
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const [name, setName] = useState("");
|
||||
const [phone, setPhone] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
@@ -29,7 +31,7 @@ const Signup = (props) => {
|
||||
const [specialCharValid, setSpecialCharValid] = useState(false);
|
||||
|
||||
const togglePasswordVisibility = () => setShowPassword(!showPassword);
|
||||
const image = props.appInfo.applogo;
|
||||
const image = appInfo.applogo;
|
||||
|
||||
const clearStorage = async () => {
|
||||
if (Parse.User.current()) {
|
||||
@@ -90,7 +92,7 @@ const Signup = (props) => {
|
||||
res
|
||||
.then(async (r) => {
|
||||
if (r) {
|
||||
let roleData = props.appInfo.settings;
|
||||
let roleData = appInfo.settings;
|
||||
if (roleData && roleData.length > 0) {
|
||||
const params = {
|
||||
userDetails: {
|
||||
@@ -99,7 +101,7 @@ const Signup = (props) => {
|
||||
name: name,
|
||||
email: email,
|
||||
phone: phone,
|
||||
role: props.appInfo.defaultRole
|
||||
role: appInfo.defaultRole
|
||||
}
|
||||
};
|
||||
try {
|
||||
@@ -181,8 +183,8 @@ const Signup = (props) => {
|
||||
// Check extended class user role and tenentId
|
||||
try {
|
||||
let userRoles = [];
|
||||
if (props.appInfo.settings) {
|
||||
let userSettings = props.appInfo.settings;
|
||||
if (appInfo.settings) {
|
||||
let userSettings = appInfo.settings;
|
||||
|
||||
//Get Current user roles
|
||||
let url = `${baseUrl}functions/UserGroups`;
|
||||
@@ -256,8 +258,10 @@ const Signup = (props) => {
|
||||
}
|
||||
});
|
||||
if (tenentInfo.length) {
|
||||
props.showTenantName(
|
||||
tenentInfo[0].tenentName || ""
|
||||
dispatch(
|
||||
showTenant(
|
||||
tenentInfo[0].tenentName || ""
|
||||
)
|
||||
);
|
||||
localStorage.setItem(
|
||||
"TenantName",
|
||||
@@ -300,8 +304,8 @@ const Signup = (props) => {
|
||||
}
|
||||
});
|
||||
if (tenentInfo.length) {
|
||||
props.showTenantName(
|
||||
tenentInfo[0].tenentName || ""
|
||||
dispatch(
|
||||
showTenant(tenentInfo[0].tenentName || "")
|
||||
);
|
||||
localStorage.setItem(
|
||||
"TenantName",
|
||||
@@ -433,7 +437,7 @@ const Signup = (props) => {
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
props.fetchAppInfo();
|
||||
dispatch(fetchAppInfo());
|
||||
// eslint-disable-next-line
|
||||
}, []);
|
||||
|
||||
@@ -479,7 +483,7 @@ const Signup = (props) => {
|
||||
|
||||
<Title title={"Signup page"} />
|
||||
|
||||
{props.isloginVisible && props.isloginVisible ? (
|
||||
{appInfo && appInfo.applogo ? (
|
||||
<div>
|
||||
<div className="md:m-10 lg:m-16 md:p-4 lg:p-10 p-5 bg-[#ffffff] md:border-[1px] md:border-gray-400 ">
|
||||
<div className="w-[250px] h-[66px] inline-block">
|
||||
@@ -657,15 +661,4 @@ const Signup = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
if (Object.keys(state.appInfo).length !== 0) {
|
||||
return { appInfo: state.appInfo, isloginVisible: true };
|
||||
} else {
|
||||
return { appInfo: state.appInfo, isloginVisible: false };
|
||||
}
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, {
|
||||
fetchAppInfo,
|
||||
showTenantName
|
||||
})(Signup);
|
||||
export default Signup
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
import Parse from "parse";
|
||||
import axios from "axios";
|
||||
import { appInfo } from "../../constant/appinfo";
|
||||
|
||||
//For fetching application Information
|
||||
export const fetchAppInfo = () => async (dispatch) => {
|
||||
localStorage.setItem("_appName", appInfo.appname);
|
||||
localStorage.setItem("_app_objectId", appInfo.objectId);
|
||||
localStorage.setItem("baseUrl", `${appInfo.baseUrl}/`);
|
||||
localStorage.setItem("parseAppId", appInfo.appId);
|
||||
localStorage.setItem("appLogo", appInfo.applogo);
|
||||
localStorage.setItem("appVersion", appInfo.version);
|
||||
localStorage.removeItem("userSettings");
|
||||
localStorage.setItem("userSettings", JSON.stringify(appInfo.settings));
|
||||
localStorage.setItem("appTitle", appInfo.appTitle);
|
||||
localStorage.setItem("fev_Icon", appInfo.fev_Icon);
|
||||
// console.log("response ", response);
|
||||
dispatch({ type: "FATCH_APPINFO", payload: appInfo });
|
||||
};
|
||||
|
||||
//for simple login
|
||||
export const login = (username, password) => async (dispatch) => {
|
||||
let res = {};
|
||||
let baseUrl = localStorage.getItem("baseUrl");
|
||||
let parseAppId = localStorage.getItem("parseAppId");
|
||||
try {
|
||||
await Parse.User.logIn(username, password).then(
|
||||
async function (res1) {
|
||||
var resultjson = res1.toJSON();
|
||||
res = res1.toJSON();
|
||||
localStorage.setItem("userEmail", username);
|
||||
localStorage.setItem("username", resultjson.name);
|
||||
localStorage.setItem("accesstoken", resultjson.sessionToken);
|
||||
localStorage.setItem("scriptId", true);
|
||||
if (resultjson.ProfilePic) {
|
||||
localStorage.setItem("profileImg", resultjson.ProfilePic);
|
||||
} else {
|
||||
localStorage.setItem("profileImg", "");
|
||||
}
|
||||
let url = `${baseUrl}functions/UserGroups`;
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": parseAppId,
|
||||
sessionToken: resultjson.sessionToken
|
||||
};
|
||||
|
||||
let body = {
|
||||
appname: localStorage.getItem("domain")
|
||||
};
|
||||
let userGroup = "",
|
||||
userGroup1 = "";
|
||||
await axios
|
||||
.post(url, JSON.stringify(body), { headers: headers })
|
||||
.then(async (response) => {
|
||||
userGroup = response.data.result[0];
|
||||
userGroup1 = response.data.result[1];
|
||||
localStorage.setItem("_userGroup", userGroup);
|
||||
});
|
||||
|
||||
let appSetings = JSON.parse(localStorage.getItem("userSettings"));
|
||||
let defaultmenuid = "",
|
||||
PageLanding = "",
|
||||
pageType = "";
|
||||
|
||||
appSetings.forEach(async (element) => {
|
||||
if (`${localStorage.getItem("_appName")}_appeditor` === userGroup) {
|
||||
if (element.role === userGroup1) {
|
||||
defaultmenuid = element.menuId;
|
||||
PageLanding = element.pageId;
|
||||
pageType = element.pageType;
|
||||
localStorage.setItem("PageLanding", PageLanding);
|
||||
localStorage.setItem("defaultmenuid", defaultmenuid);
|
||||
localStorage.setItem("pageType", pageType);
|
||||
let _role = userGroup1.replace(
|
||||
`${localStorage.getItem("_appName")}_`,
|
||||
""
|
||||
);
|
||||
if (userGroup1) {
|
||||
localStorage.setItem("_user_role", _role);
|
||||
} else {
|
||||
localStorage.setItem("_user_role", _role);
|
||||
}
|
||||
}
|
||||
} else if (element.role === userGroup) {
|
||||
defaultmenuid = element.menuId;
|
||||
PageLanding = element.pageId;
|
||||
pageType = element.pageType;
|
||||
localStorage.setItem("PageLanding", PageLanding);
|
||||
localStorage.setItem("defaultmenuid", defaultmenuid);
|
||||
localStorage.setItem("pageType", pageType);
|
||||
localStorage.setItem("extended_class", element.extended_class);
|
||||
let _role = userGroup.replace(
|
||||
`${localStorage.getItem("domain")}_`,
|
||||
""
|
||||
);
|
||||
if (userGroup) {
|
||||
localStorage.setItem("_user_role", _role);
|
||||
} else {
|
||||
localStorage.setItem("_user_role", _role);
|
||||
}
|
||||
try {
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
}).then(
|
||||
(results) => {
|
||||
let userinfo = results.toJSON();
|
||||
if (userinfo.TenantId) {
|
||||
localStorage.setItem("TenetId", userinfo.TenantId.objectId);
|
||||
}
|
||||
// console.log("tour found", results);
|
||||
},
|
||||
(error) => {
|
||||
console.error("Error while fetching tour", error);
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.log("err ", error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dispatch({ type: "APP_LOGIN", payload: res });
|
||||
|
||||
if (pageType !== "") {
|
||||
window.location = `/${pageType}/${PageLanding}`;
|
||||
} else {
|
||||
alert("You dont have access to this application.");
|
||||
localStorage.setItem("accesstoken", null);
|
||||
}
|
||||
},
|
||||
function () {
|
||||
alert("Invalid Login");
|
||||
localStorage.setItem("accesstoken", null);
|
||||
}
|
||||
);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
alert("You dont have access to this application.");
|
||||
localStorage.setItem("accesstoken", null);
|
||||
}
|
||||
};
|
||||
|
||||
//for reset password
|
||||
export const forgetPassword = (username) => async () => {
|
||||
try {
|
||||
await Parse.User.requestPasswordReset(username).then(
|
||||
async function (res1) {
|
||||
// var resultjson = res1;
|
||||
// console.log("post data", resultjson.length);
|
||||
if (res1.data === undefined) {
|
||||
alert("Reset password link has been sent to your email id ");
|
||||
}
|
||||
},
|
||||
function () {
|
||||
// alert("Password Reset Done")
|
||||
}
|
||||
);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
};
|
||||
|
||||
// Role field wizard
|
||||
export const fetchRoleEnum = (name) => async (dispatch) => {
|
||||
let response = [];
|
||||
let baseUrl = localStorage.getItem("baseUrl");
|
||||
let parseAppId = localStorage.getItem("parseAppId");
|
||||
try {
|
||||
let url = `${baseUrl}roles?where={"name":{"$regex":"${name}","$ne":"${localStorage.getItem(
|
||||
"domain"
|
||||
)}_appeditor"}}`;
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": parseAppId
|
||||
};
|
||||
await axios.get(url, { headers: headers }).then((res) => {
|
||||
let temp = [];
|
||||
res.data.results.forEach((x) => {
|
||||
temp.push(x["name"]);
|
||||
});
|
||||
response = temp;
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Problem", e);
|
||||
}
|
||||
dispatch({ type: "FETCH_ROLE", payload: response });
|
||||
};
|
||||
|
||||
export const showTenantName = (name) => async (dispatch) => {
|
||||
dispatch({ type: "SHOW_TENANT", payload: name || null });
|
||||
};
|
||||
|
||||
export const save_tourSteps = (steps) => async (dispatch) => {
|
||||
dispatch({ type: "SAVE_TOURSTEPS", payload: steps });
|
||||
};
|
||||
|
||||
export const remove_tourSteps = () => async (dispatch) => {
|
||||
dispatch({ type: "REMOVE_TOURSTEPS", payload: [] });
|
||||
};
|
||||
@@ -1,9 +1,14 @@
|
||||
const ShowTenant = (state = "", action) => {
|
||||
switch (action.type) {
|
||||
case "SHOW_TENANT":
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
const showTenantSlice = createSlice({
|
||||
name: "showTenant",
|
||||
initialState: "",
|
||||
reducers: {
|
||||
showTenant: (state, action) => {
|
||||
return action.payload;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
export default ShowTenant;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { showTenant } = showTenantSlice.actions;
|
||||
export default showTenantSlice.reducer;
|
||||
@@ -1,11 +1,17 @@
|
||||
const tourStepReducer = (state = "", action) => {
|
||||
switch (action.type) {
|
||||
case "SAVE_TOURSTEPS":
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
const tourStepSlice = createSlice({
|
||||
name: "tourStep",
|
||||
initialState: [],
|
||||
reducers: {
|
||||
saveTourSteps: (state, action) => {
|
||||
return action.payload;
|
||||
case "REMOVE_TOURSTEPS":
|
||||
},
|
||||
removeTourSteps: () => {
|
||||
return [];
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
};
|
||||
export default tourStepReducer;
|
||||
});
|
||||
|
||||
export const { saveTourSteps, removeTourSteps } = tourStepSlice.actions;
|
||||
export default tourStepSlice.reducer;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { combineReducers } from "redux";
|
||||
import infoReducer from "./infoReducer";
|
||||
import loginReducer from "./loginReducer";
|
||||
import ShowTenant from "./ShowTenant";
|
||||
import TourStepsReducer from "./TourStepsReducer";
|
||||
|
||||
export default combineReducers({
|
||||
appInfo: infoReducer,
|
||||
login: loginReducer,
|
||||
ShowTenant,
|
||||
TourSteps: TourStepsReducer
|
||||
TourSteps: TourStepsReducer,
|
||||
ShowTenant
|
||||
});
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
const infoReducer = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case "FATCH_APPINFO":
|
||||
return action.payload;
|
||||
default:
|
||||
return state;
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
import { appInfo } from "../../constant/appinfo";
|
||||
|
||||
const infoSlice = createSlice({
|
||||
name: "info",
|
||||
initialState: {},
|
||||
reducers: {
|
||||
fetchAppInfo: () => {
|
||||
localStorage.setItem("_appName", appInfo.appname);
|
||||
localStorage.setItem("_app_objectId", appInfo.objectId);
|
||||
localStorage.setItem("baseUrl", `${appInfo.baseUrl}/`);
|
||||
localStorage.setItem("parseAppId", appInfo.appId);
|
||||
localStorage.setItem("appLogo", appInfo.applogo);
|
||||
localStorage.setItem("appVersion", appInfo.version);
|
||||
localStorage.removeItem("userSettings");
|
||||
localStorage.setItem("userSettings", JSON.stringify(appInfo.settings));
|
||||
localStorage.setItem("appTitle", appInfo.appTitle);
|
||||
localStorage.setItem("fev_Icon", appInfo.fev_Icon);
|
||||
return appInfo;
|
||||
}
|
||||
}
|
||||
};
|
||||
export default infoReducer;
|
||||
});
|
||||
export const { fetchAppInfo } = infoSlice.actions;
|
||||
export default infoSlice.reducer;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
const loginReducer = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case "APP_LOGIN":
|
||||
return action.payload;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
export default loginReducer;
|
||||
@@ -1,5 +1,16 @@
|
||||
import { createStore, applyMiddleware } from "redux";
|
||||
import thunk from "redux-thunk";
|
||||
import reducers from "./reducers";
|
||||
// import { createStore, applyMiddleware } from "redux";
|
||||
// import thunk from "redux-thunk";
|
||||
// import reducers from "./reducers";
|
||||
|
||||
export const store = createStore(reducers, applyMiddleware(thunk));
|
||||
// export const store = createStore(reducers, applyMiddleware(thunk));
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import infoReducer from "./reducers/infoReducer";
|
||||
import ShowTenant from "./reducers/ShowTenant";
|
||||
import TourStepsReducer from "./reducers/TourStepsReducer";
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
appInfo: infoReducer,
|
||||
TourSteps: TourStepsReducer,
|
||||
ShowTenant
|
||||
}
|
||||
});
|
||||
|
||||
@@ -63,13 +63,12 @@ export default async function (request) {
|
||||
sessionToken: user.sessionToken, //localStorage.getItem("accesstoken"),
|
||||
};
|
||||
let body = {
|
||||
appName: extClass, //props.appInfo.appname,
|
||||
roleName: userDetails.role, //props.appInfo.defaultRole,
|
||||
appName: extClass,
|
||||
roleName: userDetails.role,
|
||||
userId: user.id,
|
||||
};
|
||||
let role = await axios.post(roleurl, body, { headers: headers });
|
||||
// console.log("role ", role);
|
||||
// props.appInfo.defaultRole
|
||||
const partnerCls = Parse.Object.extend("partners_Tenant");
|
||||
const partnerQuery = new partnerCls();
|
||||
partnerQuery.set("UserId", {
|
||||
@@ -111,7 +110,7 @@ export default async function (request) {
|
||||
className: "_User",
|
||||
objectId: user.id,
|
||||
});
|
||||
newObj.set("UserRole", userDetails.role); // props.appInfo.defaultRole
|
||||
newObj.set("UserRole", userDetails.role);
|
||||
newObj.set("Email", userDetails.email);
|
||||
newObj.set("Name", userDetails.name);
|
||||
newObj.set("Phone", userDetails.phone);
|
||||
|
||||
Reference in New Issue
Block a user