import React, { useState, useEffect } from 'react'; import Page from './layout/Page'; import Table from './common/Table'; import Button from './interface/Button'; import PageHeader from './layout/PageHeader'; import Pen from 'assets/pen.svg'; import Trash from 'assets/trash.svg'; import Plus from 'assets/plus.svg'; import { get } from 'lib/web'; import Modal from './common/Modal'; import WebsiteEditForm from './forms/WebsiteEditForm'; import styles from './Settings.module.css'; import WebsiteDeleteForm from './forms/WebsiteDeleteForm'; export default function Settings() { const [data, setData] = useState(); const [edit, setEdit] = useState(); const [del, setDelete] = useState(); const [add, setAdd] = useState(); const [saved, setSaved] = useState(0); const columns = [ { key: 'name', label: 'Name' }, { key: 'domain', label: 'Domain' }, { key: 'action', cell: { className: styles.buttons, }, render: row => ( <> ), }, ]; function handleSave() { setSaved(state => state + 1); handleClose(); } function handleClose() { setAdd(null); setEdit(null); setDelete(null); } async function loadData() { setData(await get(`/api/website`)); } useEffect(() => { loadData(); }, [saved]); if (!data) { return null; } return (
Websites
{edit && ( )} {add && ( )} {del && ( )} ); }