Compare commits

..

2 Commits

2 changed files with 24 additions and 12 deletions
+13 -3
View File
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import React, { useEffect, useLayoutEffect, useState } from "react";
import { Link, useNavigate } from "react-router-dom";
import linkedInLogo from "../../../assets/images/Linkedin.png";
import appleLogo from "../../../assets/images/apple-black.svg";
@@ -17,7 +17,7 @@ import { updateUserDetails } from "../../../store/UserDetails";
export default function Login() {
const dispatch = useDispatch();
let [loginType, setLoginType] = useState(document.cookie.includes("loginType=family")? 'family': document.cookie.includes("loginType=full") ? 'full' : 'full');
let [loginType, setLoginType] = useState('');
const [checked, setValue] = useState(false);
const [loginLoading, setLoginLoading] = useState(false);
@@ -38,7 +38,7 @@ export default function Login() {
let expirationDate = new Date(currentDate.getTime() + (24 * 60 * 60 * 1000));
// Convert the expiration date to the appropriate format
let expirationDateString = expirationDate.toUTCString();
document.cookie = `loginType=${name}; expires=${expirationDateString}; path=/login;`;
document.cookie = `loginType=${name}; expires=${expirationDateString}; path=/;`;
};
// email
@@ -148,6 +148,16 @@ export default function Login() {
// document.cookie ="loginType=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
// }, []);
useLayoutEffect(()=>{ // checks the cookie in order to set the login type before components mounts
if(document.cookie.includes("loginType=family")){
setLoginType('family')
}else if(document.cookie.includes("loginType=full")){
setLoginType('full')
}else{
setLoginType('full')
}
},[])
useEffect(() => {
setMail("");
setPassword("");
+11 -9
View File
@@ -45,15 +45,17 @@ export default function MyTasks({
My Tasks
</span>
</h1>
<button
type="button"
onClick={() => {
navigate("/familymarket");
}}
className="px-4 h-10 flex justify-center items-center btn-gradient text-base rounded-full text-white"
>
More Task
</button>
{ActiveJobList?.data?.length > 0 && userDetails.account_type == 'FAMILY' &&
<button
type="button"
onClick={() => {
navigate("/familymarket");
}}
className="px-4 h-10 flex justify-center items-center btn-gradient text-base rounded-full text-white"
>
More Task
</button>
}
</div>
<div className="slider-btns flex space-x-4">
<div