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

import { Redirect } from "react-router-dom";

import { Button } from 'antd';

import _auth from '@netuno/auth-client';

export default () => {
    const [ loading, setLoading ] = useState(false);
    if (!_auth.isLogged()) {
        return <Redirect to="/login"/>;
    }
    const onLogout = ()=> {
        _auth.logout();
        setLoading(true);
    }
    return (
        <div>
            <h1>Olá...</h1>
            <Button onClick={onLogout} loading={loading}>Sair</Button>
        </div>
    );
};
