mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Updated add team website form.
This commit is contained in:
parent
c990459238
commit
a14e11bae2
18 changed files with 149 additions and 129 deletions
|
|
@ -7,30 +7,30 @@ import DataTable from 'components/common/DataTable';
|
|||
function useReports() {
|
||||
const { get, del, useMutation } = useApi();
|
||||
const { mutate } = useMutation(reportId => del(`/reports/${reportId}`));
|
||||
const reports = useFilterQuery(['reports'], params => get(`/reports`, params));
|
||||
const queryResult = useFilterQuery(['reports'], params => get(`/reports`, params));
|
||||
|
||||
const deleteReport = id => {
|
||||
mutate(id, {
|
||||
onSuccess: () => {
|
||||
reports.refetch();
|
||||
queryResult.refetch();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return { reports, deleteReport };
|
||||
return { queryResult, deleteReport };
|
||||
}
|
||||
|
||||
export default function ReportsList() {
|
||||
const { reports, deleteReport } = useReports();
|
||||
const { queryResult, deleteReport } = useReports();
|
||||
|
||||
const handleDelete = async (id, callback) => {
|
||||
await deleteReport(id);
|
||||
await reports.refetch();
|
||||
await queryResult.refetch();
|
||||
callback?.();
|
||||
};
|
||||
|
||||
return (
|
||||
<DataTable {...reports.getProps()}>
|
||||
<DataTable queryResult={queryResult}>
|
||||
{({ data }) => <ReportsTable data={data} showDomain={true} onDelete={handleDelete} />}
|
||||
</DataTable>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue