Merge branch 'pending-jobs-pop-apis' of WrenchBoard/Users-Wrench into master

This commit is contained in:
2023-06-04 12:14:58 +00:00
committed by Gogs
6 changed files with 34 additions and 16 deletions
+1
View File
@@ -18,6 +18,7 @@ REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user"
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
REACT_APP_SESSION_EXPIRE_MINUTES=300000
REACT_APP_SESSION_EXPIRE_MINUTES_FAMILY=600000
REACT_APP_SESSION_EXPIRE_CHECKER=60000
REACT_APP_LOGIN_ERROR_TIMEOUT=7000
+1
View File
@@ -18,6 +18,7 @@ REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user"
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
REACT_APP_SESSION_EXPIRE_MINUTES=300000
REACT_APP_SESSION_EXPIRE_MINUTES_FAMILY=600000
REACT_APP_SESSION_EXPIRE_CHECKER=60000
REACT_APP_LOGIN_ERROR_TIMEOUT=7000
+1
View File
@@ -18,6 +18,7 @@ REACT_APP_USERS_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/svs/user"
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
REACT_APP_SESSION_EXPIRE_MINUTES=300000
REACT_APP_SESSION_EXPIRE_MINUTES_FAMILY=600000
REACT_APP_SESSION_EXPIRE_CHECKER=60000
REACT_APP_LOGIN_ERROR_TIMEOUT=7000
+1 -1
View File
@@ -100,7 +100,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
// User Profile
let { firstname, lastname, email, profile_pic } = userDetails;
let userEmail = email.split("@")[0];
let userEmail = email?.split("@")[0];
return (
<>
@@ -229,4 +229,4 @@ function PendingJobsPopout({ details, onClose, situation }) {
);
}
export default PendingJobsPopout;
export default PendingJobsPopout;
+29 -14
View File
@@ -12,23 +12,37 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
const dispatch = useDispatch();
const [lastActivityTime, setLastActivityTime] = useState(Date.now());
const [isLogin, setIsLogin] = useState({ loading: true, status: false });
const [loadProfileDetails, setLoadProfileDetails] = useState([]);
const navigate = useNavigate();
const {jobListTable} = useSelector((state) => state.tableReload)
const { jobListTable } = useSelector((state) => state.tableReload);
useEffect(() => {
//Removing Data stored at localStorage after session expires
const expireSession = () => {
localStorage.clear();
localStorage.removeItem("uid");
localStorage.removeItem("member_id");
localStorage.removeItem("session_token");
navigate("/login", { replace: true }); // redirects user to login page after session expires
};
console.log(loadProfileDetails);
const checkInactivity = setInterval(() => {
if (
Date.now() - lastActivityTime >
process.env.REACT_APP_SESSION_EXPIRE_MINUTES
) {
expireSession();
let { account_type } = loadProfileDetails;
if (account_type === "FAMILY") {
if (
Date.now() - lastActivityTime >
process.env.REACT_APP_SESSION_EXPIRE_MINUTES_FAMILY
) {
expireSession();
}
} else {
if (
Date.now() - lastActivityTime >
process.env.REACT_APP_SESSION_EXPIRE_MINUTES
) {
expireSession();
}
}
}, process.env.REACT_APP_SESSION_EXPIRE_CHECKER); // Checks for inactivity every minute
@@ -65,6 +79,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
setIsLogin({ loading: false, status: false });
return;
}
setLoadProfileDetails(res.data);
dispatch(updateUserDetails(res.data));
setIsLogin({ loading: false, status: true });
})
@@ -76,22 +91,22 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
}
}, []);
useEffect(()=>{
useEffect(() => {
const getMyJobList = async () => {
dispatch(updateUserJobList({loading: true, data:[]}))
dispatch(updateUserJobList({ loading: true, data: [] }));
try {
const res = await apiCall.getMyJobList();
// setMyJobList({loading: false, data:res.data})
// setMyJobList(res.data);
dispatch(updateUserJobList({loading: false, data:res.data}))
dispatch(updateUserJobList({ loading: false, data: res.data }));
} catch (error) {
dispatch(updateUserJobList({loading: false, data:[]}))
dispatch(updateUserJobList({ loading: false, data: [] }));
// setMyJobList({loading: false, data:[]})
console.log("Error getting mode");
}
};
getMyJobList()
},[jobListTable])
getMyJobList();
}, [jobListTable]);
useEffect(() => {
// Getting market data