top banner offer list display fixed
This commit was merged in pull request #791.
This commit is contained in:
@@ -5,6 +5,7 @@ import usersService from "../../services/UsersService";
|
||||
import { useSelector } from "react-redux";
|
||||
import FamilyDash from "./FamilyDash";
|
||||
import FullAccountDash from "./FullAccountDash";
|
||||
import LoadingSpinner from '../../components/Spinners/LoadingSpinner'
|
||||
|
||||
export default function Home(props) {
|
||||
// console.log("PROPS IN HOME->", props);
|
||||
@@ -12,7 +13,8 @@ export default function Home(props) {
|
||||
const { commonHeadBanner } = useSelector((state) => state.commonHeadBanner);
|
||||
|
||||
let [nextDueTask, setNextDueTask] = useState({});
|
||||
const [MyOffersList, setMyOffersList] = useState({loading: true, data: []});
|
||||
|
||||
// const [MyOffersList, setMyOffersList] = useState({loading: true, data: []});
|
||||
|
||||
const { userDetails } = useSelector((state) => state?.userDetails);
|
||||
|
||||
@@ -46,19 +48,19 @@ export default function Home(props) {
|
||||
});
|
||||
};
|
||||
|
||||
const getMyOffersList = async () => {
|
||||
try {
|
||||
const res = await userApi.getOffersList();
|
||||
setMyOffersList({loading:false, data:res.data});
|
||||
} catch (error) {
|
||||
setMyOffersList({loading:false, data:[]});
|
||||
console.log("Error getting offers", error);
|
||||
}
|
||||
};
|
||||
// const getMyOffersList = async () => {
|
||||
// try {
|
||||
// const res = await userApi.getOffersList();
|
||||
// setMyOffersList({loading:false, data:res.data});
|
||||
// } catch (error) {
|
||||
// setMyOffersList({loading:false, data:[]});
|
||||
// console.log("Error getting offers", error);
|
||||
// }
|
||||
// };
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
await Promise.all([getHomeDate(), getMyOffersList(), getMyActiveJobList()]);
|
||||
await Promise.all([getHomeDate(), getMyActiveJobList()]);
|
||||
};
|
||||
if(userDetails?.account_type == 'FULL'){
|
||||
fetchData();
|
||||
@@ -67,6 +69,9 @@ export default function Home(props) {
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
{Object.keys(commonHeadBanner).length < 1 ?
|
||||
<LoadingSpinner height='h-48' size='16' />
|
||||
:
|
||||
<div className="w-full">
|
||||
{userDetails && userDetails?.account_type == "FAMILY" ? (
|
||||
<FamilyDash
|
||||
@@ -81,8 +86,10 @@ export default function Home(props) {
|
||||
nextDueTask={nextDueTask}
|
||||
bannerList={props.bannerList}
|
||||
dashTypes={props.dashTypes}
|
||||
offersList={MyOffersList}
|
||||
// offersList={MyOffersList}
|
||||
MyActiveJobList={MyActiveJobList}
|
||||
offersList={props.offersList}
|
||||
imageServer={props.imageServer}
|
||||
/>
|
||||
) : (
|
||||
<div>
|
||||
@@ -90,6 +97,7 @@ export default function Home(props) {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user