import React, { useState, useEffect } from "react";

import Table from 'antd/lib/table';
import Column from "antd/lib/table/Column";
import Tag from "antd/lib/tag";


const columns = [
    {
        title: "Tipo",
        dataIndex: "tipo"
    }

];
const TabelaCategoria = () => {


    const [data, setData] = useState([]);

    useEffect(() => {
        const fail = () => {
            this.setState({ loading: false });
            notification["error"]({
                message: 'Erro',
                description: 'Tabela de Categoria com erros existentes',
                style: {
                    marginTop: 100,
                }
            });
        };
        netuno.service({
            url: '/services/categorias',
            method: 'POST',
            credentials: 'include',
            headers: {
                'Content-Type': 'application/json'
            },
            success: (response) => {

                if (response.json) {

                    setData(response.json);
                } else {
                    fail();
                }
            },
            fail: () => {
                fail();
            }

        });
        }, []);


        return <Table columns={columns} dataSource={data} />
};

export default TabelaCategoria;