Compare commits

...

12 Commits

Author SHA1 Message Date
victorAnumudu 7e7176ae5c server icon fix 2023-11-11 07:03:54 +01:00
victorAnumudu 306fa1300d replaced images to server images on mytask route 2023-11-11 06:26:00 +01:00
ameye 7b3178bd1a Merge branch 'add-family-btn-bug' of WrenchBoard/Users-Wrench into master 2023-11-10 17:50:11 +00:00
victorAnumudu 5e94ddee48 fixed add family btn 2023-11-09 07:09:24 +01:00
ameye 32171ae3ce Merge branch 'Server-path-added' of WrenchBoard/Users-Wrench into master 2023-11-08 19:47:53 +00:00
Chief Bube 2c99fedd8c removing session once user logs out or session expires 2023-11-08 10:58:42 -08:00
Chief Bube 7e926cc7bc added family image 2023-11-08 10:42:54 -08:00
ameye 587bcaa411 Merge branch 'family-wallet-copy' of WrenchBoard/Users-Wrench into master 2023-11-08 17:56:42 +00:00
ameye 756628ee1a Merge branch 'image-bug' of WrenchBoard/Users-Wrench into master 2023-11-08 17:56:37 +00:00
victorAnumudu c77d8e5693 merged from master branch 2023-11-08 18:18:06 +01:00
victorAnumudu 7e9d734e6f added copy wallet for family member 2023-11-08 18:15:21 +01:00
Chief Bube 0c1db6b4b5 fixed svg typos 2023-11-07 23:00:12 -08:00
24 changed files with 242 additions and 92 deletions
+2 -2
View File
@@ -167,7 +167,7 @@ function AddJob({ popUpHandler, categories }) {
onChange={props.handleChange}
onBlur={props.handleBlur}
>
{walletDetails.loading ? (
{walletDetails?.loading ? (
<option className="text-slate-500 text-lg" value="">
Loading...
</option>
@@ -400,7 +400,7 @@ function AddJob({ popUpHandler, categories }) {
</span>
</button>
{requestStatus.loading ? (
{requestStatus?.loading ? (
<LoadingSpinner size="8" color="sky-blue" />
) : (
<button
+49 -40
View File
@@ -17,14 +17,14 @@ import { updateUserDetails } from "../../../store/UserDetails";
import ReCAPTCHA from "react-google-recaptcha";
export default function Login() {
// eslint-disable-next-line no-restricted-globals
const queryParams = new URLSearchParams(location?.search);
const sessionExpired = queryParams.get("sessionExpired")
const sessionExpired = queryParams.get("sessionExpired");
const dispatch = useDispatch();
const { state } = useLocation();
const [validCaptcha, setValidCaptcha] = useState({show: false, valid:''}); // FOR CAPTCHA
const [validCaptcha, setValidCaptcha] = useState({ show: false, valid: "" }); // FOR CAPTCHA
let [loginType, setLoginType] = useState("");
@@ -115,7 +115,8 @@ export default function Login() {
}, Number(process.env.REACT_APP_LOGIN_ERROR_TIMEOUT));
return;
}
if(name == "full" && !validCaptcha.valid && validCaptcha.show){ // RUNS AND DISPLAYS CAPTCHA, IF ERROR OCCURED DURING LOGIN FOR FULL LOGIN ALONE
if (name == "full" && !validCaptcha.valid && validCaptcha.show) {
// RUNS AND DISPLAYS CAPTCHA, IF ERROR OCCURED DURING LOGIN FOR FULL LOGIN ALONE
setMsgError("Please Verify Captcha");
setLoginLoading(false);
setTimeout(() => {
@@ -136,12 +137,15 @@ export default function Login() {
// setMsgError("Wrong, email/password");
setLoginError(true);
setLoginLoading(false);
setValidCaptcha(prev => ({...prev, show:true})) // DISPLAYS CAPTCHA IF ERROR
setValidCaptcha((prev) => ({ ...prev, show: true })); // DISPLAYS CAPTCHA IF ERROR
return;
}
localStorage.setItem("member_id", `${res.data.member_id}`);
localStorage.setItem("uid", `${res.data.uid}`);
localStorage.setItem("session_token", `${res.data.session}`);
if (name === "family") {
sessionStorage.setItem("family_uid", res.data?.family_uid);
}
// localStorage.setItem("session", `${res.data.session}`);
dispatch(updateUserDetails({ ...res.data }));
setTimeout(() => {
@@ -152,7 +156,7 @@ export default function Login() {
.catch((error) => {
setMsgError("Unable to login, try again");
setLoginLoading(false);
setValidCaptcha(prev => ({...prev, show:true})) // DISPLAYS CAPTCHA IF ERROR
setValidCaptcha((prev) => ({ ...prev, show: true })); // DISPLAYS CAPTCHA IF ERROR
})
.finally(() => {
setTimeout(() => {
@@ -163,11 +167,12 @@ export default function Login() {
});
};
function captchaChecker(value) { // FUNCTION TO VALIDATE CAPTCHA
if(value){
setValidCaptcha({show: true, valid:value})
}else{
setValidCaptcha({show: true, valid:''})
function captchaChecker(value) {
// FUNCTION TO VALIDATE CAPTCHA
if (value) {
setValidCaptcha({ show: true, valid: value });
} else {
setValidCaptcha({ show: true, valid: "" });
}
}
@@ -245,31 +250,32 @@ export default function Login() {
</div>
<div className="content-wrapper login shadow-md w-full lg:max-w-[530px] mx-auto flex justify-center items-center xl:bg-white dark:bg-dark-white 2xl:w-[828px] rounded-[0.475rem] sm:p-7 p-5">
<div className="w-full">
{/* HIDES THIS IF USER SESSION HAS EXPIRED */}
{sessionExpired != 'true' &&
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
{/* <h1 className="text-[#181c32] font-semibold dark:text-white mb-3 leading-[27.3px] text-[22.75px]">
{sessionExpired != "true" && (
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
{/* <h1 className="text-[#181c32] font-semibold dark:text-white mb-3 leading-[27.3px] text-[22.75px]">
Sign In to WrenchBoard
</h1> */}
<span className="text-gray-400 font-medium text-[16.25px] leading-[24.375px]">
New Here?{" "}
<Link
to="/signup"
className="font-semibold text-[#4687ba] hover:text-[#009ef7] transition"
>
Create an Account
</Link>
</span>
</div>
}
<span className="text-gray-400 font-medium text-[16.25px] leading-[24.375px]">
New Here?{" "}
<Link
to="/signup"
className="font-semibold text-[#4687ba] hover:text-[#009ef7] transition"
>
Create an Account
</Link>
</span>
</div>
)}
{/* SHOWS THIS IF USER SESSION HAS EXPIRED */}
{sessionExpired == 'true' &&
<div className="w-full p-1 mb-7">
<p className="text-red-500 text-base text-center">Your session expired and will need to login again</p>
</div>
}
{sessionExpired == "true" && (
<div className="w-full p-1 mb-7">
<p className="text-red-500 text-base text-center">
Your session expired and will need to login again
</p>
</div>
)}
{/* switch login component */}
<div className="ml-7 flex justify-start items-center gap-3">
@@ -335,14 +341,16 @@ export default function Login() {
</div>
{/* hCaptha clone for the time being */}
{validCaptcha.show &&
<div className="mb-5 flex justify-center w-full">
<ReCAPTCHA
sitekey={process.env.REACT_APP_GOOGLE_RECAPTCHA_SITEKEY}
onChange={captchaChecker}
{validCaptcha.show && (
<div className="mb-5 flex justify-center w-full">
<ReCAPTCHA
sitekey={
process.env.REACT_APP_GOOGLE_RECAPTCHA_SITEKEY
}
onChange={captchaChecker}
/>
</div>
}
</div>
)}
{loginError && (
<div className="relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-thin leading-[19.5px] text-[13px]">
@@ -499,7 +507,8 @@ export default function Login() {
{loginType == "full" && (
<div className="pt-5 text-[#181c32] text-center font-semibold text-[13.975px] leading-[20.9625px]">
This site is protected by a Captcha. Our Privacy Policy and Terms of Service apply.
This site is protected by a Captcha. Our Privacy Policy and
Terms of Service apply.
</div>
)}
</div>
+1 -1
View File
@@ -47,7 +47,7 @@ export default function BlogItem(props) {
</h1>
</div>
<div className="notification-wrapper w-full bg-white p-8 rounded-2xl">
{blogdata.loading ?
{blogdata?.loading ?
<LoadingSpinner size='8' color='sky-blue' height='h-[100px]' />
:
blogdata?.data?.blogdata && blogdata.data?.blogdata.length ?
@@ -5,7 +5,7 @@ import localImgLoad from "../../lib/localImgLoad";
import CountDown from "../Helpers/CountDown";
import Icons from "../Helpers/Icons";
export default function FamilyActiveJobsCard({ datas, hidden = false }) {
export default function FamilyActiveJobsCard({ datas, hidden = false, image_server }) {
let { pathname } = useLocation();
@@ -22,7 +22,8 @@ export default function FamilyActiveJobsCard({ datas, hidden = false }) {
}
};
//debugger;
const bannerName = datas.banner == null ?'default.jpg':datas.banner;
// const bannerName = datas.banner == null ?'default.jpg':datas.banner;
let image = `${image_server}${localStorage.getItem('session_token')}/job/${datas.origin_job_uid}`
return (
<div className="card-style-one flex flex-col justify-between w-full h-[387px] bg-white dark:bg-dark-white p-3 pb rounded-2xl">
<div className="content">
@@ -31,10 +32,13 @@ export default function FamilyActiveJobsCard({ datas, hidden = false }) {
{/* thumbnail image */}
<div
className="thumbnail w-full h-full rounded-xl overflow-hidden px-4 pt-4"
// style={{
// background: `url(${localImgLoad(
// `images/taskbanners/${bannerName}`
// )}) center / contain no-repeat`,
// }}
style={{
background: `url(${localImgLoad(
`images/taskbanners/${bannerName}`
)}) center / contain no-repeat`,
background: `url(${image}) center / contain no-repeat`,
}}
>
{/* <div className="product-options flex justify-between relative">*/}
+1 -5
View File
@@ -14,11 +14,7 @@ export default function OfferCard({
datas?.currency
);
let image = localStorage.getItem("session_token")
? `${image_server}${localStorage.getItem("session_token")}/job/${
datas.job_uid
}`
: "";
let image = `${image_server}${localStorage.getItem("session_token")}/job/${datas.job_uid}`
return (
<div className="card-style-one flex flex-col justify-between w-full h-[387px] bg-white dark:bg-dark-white p-3 pb rounded-2xl">
@@ -201,7 +201,7 @@ const AssignTaskPopout = React.memo(
</svg>
</button>
</div>
{familyTask.loading ? (
{familyTask?.loading ? (
<div className="h-[100px] w-full flex justify-center items-center">
<LoadingSpinner color="sky-blue" size="16" />
</div>
@@ -69,7 +69,7 @@ export default function NewTasks({ formState, setFormState }) {
onChange={handleInputChange}
// onBlur={props.handleBlur}
>
{currency.loading ? (
{currency?.loading ? (
<option className="text-slate-500 text-[13.975px]" value="">
Loading...
</option>
+1 -1
View File
@@ -87,7 +87,7 @@ export default function FamilyTable({
</div>
<div className="flex flex-col flex-[0.9]">
<h1 className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
{`${firstname} ${lastname} (${age})`}
{`${firstname} ${lastname} (${age < 10 ? `0${age}` : age})`}
</h1>
<span className="text-sm text-thin-light-gray">
Added: <span className="text-purple ml-1">{addedDate}</span>
+1 -1
View File
@@ -151,7 +151,7 @@ export default function FamilyAcc() {
>
Family Accounts
</span>
{familyList.length < process.env.REACT_APP_MAX_FAMILY_MEMBERS &&
{familyList?.result_list?.length < process.env.REACT_APP_MAX_FAMILY_MEMBERS &&
!loader && (
<button
onClick={popUpHandler}
+3 -3
View File
@@ -478,13 +478,13 @@ export default function Icons({ name }) {
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
strokeWidth="1.5"
stroke="currentColor"
className="w-4 h-4"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
strokeLinecap="round"
strokeLinejoin="round"
d="M8.25 4.5l7.5 7.5-7.5 7.5"
/>
</svg>
+2 -2
View File
@@ -4,7 +4,7 @@ import Icons from "../Helpers/Icons";
import SliderCom from "../Helpers/SliderCom";
import FamilyActiveJobsCard from "../Cards/FamilyActiveJobsCard";
export default function FamilyActiveLSlde({ className, trending }) {
export default function FamilyActiveLSlde({ className, trending, image_server }) {
const settings = {
arrows: false,
slidesToShow: 3,
@@ -98,7 +98,7 @@ export default function FamilyActiveLSlde({ className, trending }) {
{trending &&
trending.length > 0 &&
trending.map((item) => (
<FamilyActiveJobsCard key={item.id} datas={item} />
<FamilyActiveJobsCard key={item.id} datas={item} image_server={image_server} />
))}
</SliderCom>
</div>
+1 -1
View File
@@ -19,7 +19,7 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) {
/>
)}
{trending && trending.length > 0 && (
<FamilyActiveLSlde trending={trending} className="mb-10" />
<FamilyActiveLSlde trending={trending} className="mb-10" image_server={familyOffers?.session_image_server} />
)}
{/*<TopSellerTopBuyerSliderSection className="mb-10" />*/}
+1
View File
@@ -34,6 +34,7 @@ export default function FullAccountDash(props) {
<MyJobTable
ActiveJobList={props.MyActiveJobList}
Account={userDetails}
imageServer={props.offersList?.data?.session_image_server}
/>
</>
) : !props.offersList?.loading && !props.MyActiveJobList?.loading ? (
+1 -1
View File
@@ -220,7 +220,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
contentBodyClasses="w-auto min-w-max"
/>
</div>
{MyJobList.loading ? (
{MyJobList?.loading ? (
<LoadingSpinner size="16" color="sky-blue" />
) : (
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between min-h-[520px]">
+4 -3
View File
@@ -10,7 +10,7 @@ import localImgLoad from "../../lib/localImgLoad";
const noTasksBg = require("../../assets/images/no-task-background.jpg");
const noFamilyTasksBg = require("../../assets/images/family-no-task-background.jpg");
export default function MyJobTable({ className, ActiveJobList, Account }) {
export default function MyJobTable({ className, ActiveJobList, Account, imageServer }) {
let navigate = useNavigate();
let { pathname } = useLocation();
@@ -55,7 +55,7 @@ export default function MyJobTable({ className, ActiveJobList, Account }) {
{!ActiveJobList?.data.length && accountType && (
<div className="absolute inset-0 bg-black opacity-30"></div>
)}
{ActiveJobList.loading ?
{ActiveJobList?.loading ?
<div className="w-full h-[520px] flex items-center justify-center">
<LoadingSpinner size="16" color="sky-blue" />
</div>
@@ -71,6 +71,7 @@ export default function MyJobTable({ className, ActiveJobList, Account }) {
task?.currency_code,
task?.currency
);
let image = `${imageServer}${localStorage.getItem('session_token')}/job/${task.origin_job_uid}`
return (
<div
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] w-full flex justify-between items-center hover:bg-gray-50"
@@ -80,7 +81,7 @@ export default function MyJobTable({ className, ActiveJobList, Account }) {
<div className="flex space-x-2 items-center">
<div className="w-full min-w-[60px] max-w-[60px] flex-[0.1] h-[60px] rounded-full overflow-hidden flex justify-center items-center">
<img
src={localImgLoad(`images/taskbanners/${task?.banner}`)}
src={image}
alt="data"
className="w-full h-full"
/>
+1 -1
View File
@@ -122,7 +122,7 @@ export default function MyOffersTable({ className, MyActiveOffersList }) {
MyActiveOffersList?.result_list?.length > 0 &&
MyActiveOffersList.result_list.map((item) => {
return (
<OfferCard key={item.id} datas={item} setOfferPopout={setOfferPopout} />
<OfferCard key={item.id} datas={item} setOfferPopout={setOfferPopout} image_server={MyActiveOffersList.session_image_server} />
)
})}
</SliderCom>
+1 -1
View File
@@ -94,7 +94,7 @@ export default function MyTasks({
</button>
}
</div>
<MyJobTable ActiveJobList={ActiveJobList} Account={userDetails} />
<MyJobTable ActiveJobList={ActiveJobList} Account={userDetails} imageServer={MyActiveOffersList.session_image_server} />
</div>
</div>
</Layout>
@@ -170,9 +170,9 @@ function ConfirmNairaWithdraw({
viewBox="0 0 24 24"
fill="none"
stroke="green"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="feather feather-check-circle"
>
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
@@ -186,9 +186,9 @@ function ConfirmNairaWithdraw({
width="100"
height="100"
stroke="red"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="feather feather-x-circle"
>
<circle cx="12" cy="12" r="10"></circle>
+21
View File
@@ -1,5 +1,7 @@
import { useSelector } from "react-redux";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import WalletItemCard from "./WalletItemCard";
import WalletItemCardFamily from "./WalletItemCardFamily";
/**
* Renders a list of wallet items or a loading spinner depending on the state of the `wallet` object.
@@ -7,9 +9,27 @@ import WalletItemCard from "./WalletItemCard";
export default function WalletBox({ wallet, payment, countries }) {
const { loading, data } = wallet;
const { userDetails } = useSelector((state) => state.userDetails);
const accountType = userDetails?.account_type === "FAMILY";
return (
<div className="my-wallet-wrapper w-full mb-10">
<div className="main-wrapper w-full">
{accountType ?
<div className="balance-inquery w-auto grid sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-[repeat(auto-fill,_minmax(354px,_1fr))] min-[1440px]:grid-cols-[repeat(auto-fill,_minmax(415px,_1fr))] gap-5 mb-11 h-auto">
{loading ? (
<div className="w-full h-full flex items-center justify-center">
<LoadingSpinner size="16" color="sky-blue" />
</div>
) : (
data.length > 0 && data.map((item) => (
<div key={item.wallet_uid} className="lg:w-full h-full mb-10 lg:mb-0">
<WalletItemCardFamily walletItem={item} payment={payment} countries={countries} />
</div>
))
)}
</div>
:
<div className="balance-inquery w-auto grid sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-[repeat(auto-fill,_minmax(354px,_1fr))] min-[1440px]:grid-cols-[repeat(auto-fill,_minmax(415px,_1fr))] gap-5 mb-11 h-auto">
{loading ? (
<div className="w-full h-full flex items-center justify-center">
@@ -23,6 +43,7 @@ export default function WalletBox({ wallet, payment, countries }) {
))
)}
</div>
}
</div>
</div>
);
+6 -9
View File
@@ -11,8 +11,7 @@ import WalletAction from "./WalletAction";
* Renders a card displaying information about a wallet item.
*/
export default function WalletItemCard({ walletItem, payment, countries }) {
const { userDetails } = useSelector((state) => state.userDetails);
const accountType = userDetails?.account_type === "FAMILY";
const dispatch = useDispatch();
const [creditPopup, setCreditPopup] = useState({ show: false, data: {} });
@@ -91,13 +90,11 @@ export default function WalletItemCard({ walletItem, payment, countries }) {
<div className="my-2 w-full h-[1px] bg-white"></div>
{!accountType && (
<WalletAction
walletItem={{ ...walletItem, walletCountry: currentWalletCurrency }}
payment={payment}
openPopUp={openPopUp}
/>
)}
<WalletAction
walletItem={{ ...walletItem, walletCountry: currentWalletCurrency }}
payment={payment}
openPopUp={openPopUp}
/>
</div>
{creditPopup.show && (
@@ -0,0 +1,109 @@
import React, { useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import background from "../../assets/images/bg-sky-blue.jpg"; //shape/balance-bg.svg";
import localImgLoad from "../../lib/localImgLoad";
import { tableReload } from "../../store/TableReloads";
import { PriceFormatter } from "../Helpers/PriceFormatter";
import CreditPopup from "./Popup/CreditPopup";
import WalletAction from "./WalletAction";
/**
* Renders a card displaying information about a wallet item.
*/
export default function WalletItemCardFamily({ walletItem, payment, countries }) {
const dispatch = useDispatch();
const [creditPopup, setCreditPopup] = useState({ show: false, data: {} });
/**
* Opens the credit popup.
* @param {Object} value - The value object.
*/
const openPopUp = (value) => {
setCreditPopup({
show: true,
data: { ...value },
});
};
/**
* Closes the credit popup and dispatches a table reload action.
*/
const closePopUp = () => {
setCreditPopup({ show: false, data: {} });
dispatch(tableReload({ type: "WALLETTABLE" }));
};
const currentWalletCurrency = countries
.map((country) => country)
.filter((country) => country[0] === walletItem.country);
const image = walletItem.code
? `${walletItem.code.toLowerCase()}.svg`
: "default.png";
return (
<>
<div
className="current-balance-widget w-full h-full rounded-2xl overflow-hidden flex flex-col items-center gap-2 p-8 justify-between"
style={{
background: `url(${background}) 0% 0% / cover no-repeat`,
}}
>
<div className="wallet w-full flex justify-between items-start gap-3">
<div className="min-w-[100px] min-h-[100px] max-w-min md:max-w-[150px] max-h-min md:max-h-[150px] rounded-full bg-[#e3e3e3] flex justify-center items-center">
<img
src={localImgLoad(`images/currency/${image}`)}
className="w-full h-full"
alt="currency-icon"
/>
</div>
<div className="balance w-full mt-2 flex justify-center">
<div className="">
<p className="text-base sm:text-lg text-white opacity-[70%] tracking-wide mb-2 sm:mb-6">
Current Balance
</p>
<p className="text-[44px] lg:text-[62px] font-bold text-white tracking-wide leading-10 xxs:scale-100 lg:scale-100 xl:scale-125">
{PriceFormatter(
walletItem.amount * 0.01,
walletItem.code,
undefined,
"text-[2rem]"
)}
</p>
</div>
</div>
</div>
<p className="text-lg text-white tracking-wide flex justify-center items-center gap-8">
HOLDINGS :{" "}
<span className="xxs:scale-100 lg:scale-100 xl:scale-125">
{PriceFormatter(
walletItem.escrow * 0.01,
walletItem.code,
undefined,
"text-[2rem]"
)}
</span>
</p>
<div className="my-2 w-full h-[1px] bg-white"></div>
{/* <WalletAction
walletItem={{ ...walletItem, walletCountry: currentWalletCurrency }}
payment={payment}
openPopUp={openPopUp}
/> */}
</div>
{creditPopup.show && (
<CreditPopup
details={creditPopup.data}
walletItem={walletItem}
onClose={closePopUp}
situation={openPopUp}
/>
)}
</>
);
}
+9 -3
View File
@@ -37,11 +37,17 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
const image = localStorage.getItem("session_token")
? `${userDetails.session_image_server}${localStorage.getItem(
"session_token"
)}/profile/${userDetails.uid}`
? userDetails.account_type === "FAMILY"
? `${userDetails.session_image_server}${localStorage.getItem(
"session_token"
)}/family/${sessionStorage.getItem("family_uid")}`
: `${userDetails.session_image_server}${localStorage.getItem(
"session_token"
)}/profile/${userDetails.uid}`
: "";
// 9308RDR122
const handlerBalance = () => {
setbalanceValue.toggle();
if (notificationDropdown) {
+1
View File
@@ -23,6 +23,7 @@ export default function Layout({ children }) {
localStorage.removeItem("session_token");
localStorage.removeItem("member_id");
localStorage.removeItem("uid");
sessionStorage.removeItem("family_uid");
// localStorage.clear();
// toast.success("Come Back Soon", {
// icon: `🙂`,
+10 -5
View File
@@ -21,10 +21,12 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
const [loadProfileDetails, setLoadProfileDetails] = useState([]);
const navigate = useNavigate();
const { jobListTable, walletTable } = useSelector((state) => state.tableReload);
const { jobListTable, walletTable } = useSelector(
(state) => state.tableReload
);
const {
userDetails: { username, uid, session },
userDetails: { username, uid, session},
} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
let loggedIn = username && session && uid ? true : false; // variable to determine if user is logged in
@@ -35,6 +37,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
localStorage.removeItem("uid");
localStorage.removeItem("member_id");
localStorage.removeItem("session_token");
sessionStorage.removeItem("family_uid");
navigate("/login", { replace: true }); // redirects user to login page after session expires
};
@@ -181,13 +184,15 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
useEffect(() => {
const getMyWalletList = async () => {
dispatch(updateWalletDetails({ loading: true, data:[] }));
dispatch(updateWalletDetails({ loading: true, data: [] }));
try {
const res = await apiCall.getUserWallets();
console.log("wallet - >", res.data);
dispatch(updateWalletDetails({ loading: false, data:res.data?.result_list }));
dispatch(
updateWalletDetails({ loading: false, data: res.data?.result_list })
);
} catch (error) {
dispatch(updateWalletDetails({ loading: false, data:[] }));
dispatch(updateWalletDetails({ loading: false, data: [] }));
console.log("Error getting mode");
}
};