Merge pull request #394 from automatisch/issue-382

feat: add pagination on /flows
This commit is contained in:
Ömer Faruk Aydın
2022-08-06 19:42:23 +03:00
committed by GitHub
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} />
))}
</>