feat: add pagination on /flows

This commit is contained in:
Ali BARIN
2022-08-05 15:21:21 +02:00
parent 5a177b330a
commit 63241d2438
3 changed files with 54 additions and 10 deletions

View File

@@ -10,12 +10,15 @@ type AppFlowsProps = {
export default function AppFlows(props: AppFlowsProps): React.ReactElement {
const { appKey } = props;
const { data } = useQuery(GET_FLOWS, { variables: { appKey }});
const appFlows: IFlow[] = data?.getFlows || [];
const { data } = useQuery(GET_FLOWS, { variables: { appKey, limit: 100, offset: 0 }});
const getFlows = data?.getFlows || {};
const { edges } = getFlows;
const appFlows: IFlow[] = edges?.map(({ node }: { node: IFlow }) => node);
return (
<>
{appFlows.map((appFlow: IFlow) => (
{appFlows?.map((appFlow: IFlow) => (
<AppFlowRow key={appFlow.id} flow={appFlow} />
))}
</>