import React, { useEffect } from 'react'
import ProductFactory from '../component/product/ProductFactory'
import { useSelector } from 'react-redux';
import siteLinks from '../links/siteLinks';
import { useNavigate } from 'react-router-dom';


export default function ProductPage() {

    const navigate = useNavigate()

    const { userDetails: { profile_completed }} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active

    useEffect(()=>{
        if(!profile_completed){
            navigate(siteLinks.profile_complete, {replace: true, state:{profile_completed: false}})
        }
    },[])
    
    return (
        <ProductFactory />
    )
}
