import React, { Component } from "react";

import Table from 'antd/lib/table';
import notification from 'antd/lib/notification';

import MyButton from "../../components/MyButton/index.jsx";

import "./index.less";

import TabelaPessoas from "../../components/TabelaPessoas/index.jsx";


export default class DashboardContainer extends Component {
    constructor(props) {
        super(props);
        this.state = {
            loading: false,
            data: [],
            counter: 0
        };
        this.button = React.createRef();
        this.click = this.click.bind(this);
    }

    componentDidMount() {
        /*
        // Basic sample of the service call:
        fetch('/services/my-test.netuno', {
            credentials: 'include'
        }).then((response) => {
            return response.json();
        }).then((json) => {
            // json...;
        });
        */
        
        
        // Better sample of the recommended way to call services:
        
        
    }

    componentDidUpdate(prevProps, prevState, snapshot) {
        $(this.button.current).fadeOut(250).fadeIn(250);
    }

    click() {
        this.setState({ counter: this.state.counter + 1 });
    }

    render() {
        const { counter, data } = this.state;
        return (
            <div className="my-dashboard">
                <TabelaPessoas />
                <div className="my-dashboard__button">
                    <MyButton mainRef={ this.button } text={ `ReactJS ⚡ Ant.Design 👉 Click me! ${ counter }` } click={ this.click } />
                </div>
            </div>
        );
    }
}
