refactor: rewrite get app connections with RQ

This commit is contained in:
Rıdvan Akca
2024-04-05 15:44:23 +02:00
parent d74af4931e
commit d4e4d95b6d
8 changed files with 37 additions and 81 deletions

View File

@@ -1,20 +1,19 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { useQuery } from '@apollo/client';
import { GET_APP_CONNECTIONS } from 'graphql/queries/get-app-connections';
import AppConnectionRow from 'components/AppConnectionRow';
import NoResultFound from 'components/NoResultFound';
import useFormatMessage from 'hooks/useFormatMessage';
import * as URLS from 'config/urls';
import useAppConnections from 'hooks/useAppConnections';
function AppConnections(props) {
const { appKey } = props;
const formatMessage = useFormatMessage();
const { data } = useQuery(GET_APP_CONNECTIONS, {
variables: { key: appKey },
});
const appConnections = data?.getApp?.connections || [];
const { data } = useAppConnections(appKey);
const appConnections = data?.data || [];
const hasConnections = appConnections?.length;
if (!hasConnections) {
return (
<NoResultFound