import { useContext } from "react";
import { IndexListContext } from "../../context/IndexListContext.ts";
import ListProj from "../../components/list/ListProj.tsx";
import ListProjAgent from "../../components/list/ListProjAgent.tsx";
import { useLocation } from "react-router-dom";
// import { useLocation } from 'react-router-dom';

export default function Home() {
    const indexListContext = useContext(IndexListContext);
    // const [listData, dispatch] = useReducer<Reducer<ListData, ListAction>>(listReducer, {
    //     type: IndexListDataType.PROJ,
    //     categoryChangeCount: 0
    // });
    // console.log(listType);
    // const {state} = useLocation()
    // const [listType,setListType] = useState('0')
    // console.log('路由传递',state.listType);
    // if(state.listType){
    //     setListType(state.listType)
    // }
    // console.log('传递过来的',listType);
    console.log(indexListContext); 
    
    
    return (
        
        <div>
            {
                String(indexListContext.type) == '0' ? <ListProj /> : (
                    String(indexListContext.type) == '1' ? <ListProjAgent /> : <></>
                )
            }
            
        </div>
    )
}
