mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
loads all websites in order to edit them
This commit is contained in:
parent
1225473c20
commit
8d63d23c16
1 changed files with 15 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useState, useMemo } from 'react';
|
||||
import { useState, useMemo, useEffect } from 'react';
|
||||
import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
|
||||
import classNames from 'classnames';
|
||||
import { Button, Loading } from 'react-basics';
|
||||
|
|
@ -14,12 +14,25 @@ export function DashboardEdit({ teamId }: { teamId: string }) {
|
|||
const { websiteOrder } = settings;
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const [order, setOrder] = useState(websiteOrder || []);
|
||||
const [websites, setWebsites] = useState([]);
|
||||
|
||||
const {
|
||||
result,
|
||||
query: { isLoading },
|
||||
setParams,
|
||||
} = useWebsites({ teamId });
|
||||
|
||||
const websites = result?.data;
|
||||
useEffect(() => {
|
||||
if (result?.data) {
|
||||
setWebsites(prevWebsites => {
|
||||
const newWebsites = [...prevWebsites, ...result.data];
|
||||
if (newWebsites.length < result.count) {
|
||||
setParams(prevParams => ({ ...prevParams, page: prevParams.page + 1 }));
|
||||
}
|
||||
return newWebsites;
|
||||
});
|
||||
}
|
||||
}, [result]);
|
||||
|
||||
const ordered = useMemo(() => {
|
||||
if (websites) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue