import React, { useState, useEffect } from "react";
import PropTypes from "prop-types";

import Menu from 'antd/lib/menu';
import Dropdown from 'antd/lib/dropdown';
import Button from 'antd/lib/button';
import { DownOutlined } from '@ant-design/icons';
import Service from "../../../utils/Service";

const ListDropDown = ({user}) => {

    const [data, setData] = useState([]);
    const [loading, setLoading] = useState(true);
    useEffect(() => {
        Service.call({
            url: 'users/lists',
            method: 'post',
            body: JSON.stringify({
                uid: user.uid
            }),
            setData,
            setLoading,
            errorTitle: 'Lists Service Call',
            errorMessage: 'users/lists/post.js'
        });
    }, []);
    console.log('data: ', data);
    

    const menu = (
        
        <Menu>
          <Menu.Item key="0">
            <a href="https://www.antgroup.com">1st menu item</a>
          </Menu.Item>
          <Menu.Item key="1">
            <a href="https://www.aliyun.com">2nd menu item</a>
          </Menu.Item>
        </Menu>
      );
    
    return <> 
        <Dropdown overlay={menu} trigger={['click']}>
            <Button> 
                Click <DownOutlined /> 
            </Button>
        </Dropdown>
        </>
      


}

ListDropDown.propTypes = {

}

export default ListDropDown;