import React, { useState, useEffect } from 'react'; import { useRouter } from 'next/router'; import Link from 'components/common/Link'; import WebsiteChart from 'components/charts/WebsiteChart'; import Page from 'components/layout/Page'; import Button from 'components/common/Button'; import PageHeader from 'components/layout/PageHeader'; import EmptyPlaceholder from 'components/common/EmptyPlaceholder'; import Arrow from 'assets/arrow-right.svg'; import { get } from 'lib/web'; import styles from './WebsiteList.module.css'; export default function WebsiteList() { const [data, setData] = useState(); const router = useRouter(); async function loadData() { setData(await get(`/api/websites`)); } useEffect(() => { loadData(); }, []); if (!data) { return null; } return ( {data?.map(({ website_id, name }) => (
{name}
))} {data.length === 0 && ( )}
); }