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