import React, { useState, useEffect } from "react";
import { Redirect } from "react-router-dom";
import { Button, Spin } from 'antd';
import { CheckCircleOutlined } from '@ant-design/icons';
import _auth from '@netuno/auth-client';
import _service from '@netuno/service-client';
import Item from './Item';
import './index.less';
export default () => {
if (!_auth.isLogged()) {
return ;
}
const [ loading, setLoading ] = useState(true);
const [ communities, setCommunities ] = useState([]);
useEffect(()=> {
_service({
method: 'GET',
url: "api/communities",
success: (response) => {
setLoading(false);
setCommunities(response.json);
},
fail: (e) => {
setLoading(false);
console.log("Service User Info Error", e);
}
});
}, []);
const onLogout = ()=> {
_auth.logout();
setLoading(true);
}
if (loading) {
return ;
}
return (
{
communities.map(
(community) => {
return (
);
}
)
}
);
};