mirror of
https://github.com/logto-io/logto.git
synced 2025-03-31 22:51:25 -05:00
refactor: rename existing connectors
This commit is contained in:
parent
356aeabb54
commit
3b52af56e0
1 changed files with 8 additions and 7 deletions
|
@ -24,20 +24,21 @@ type Props = {
|
|||
};
|
||||
|
||||
const CreateForm = ({ onClose, isOpen: isFormOpen, type }: Props) => {
|
||||
const { data: connectors, error: connectorsError } = useSWR<ConnectorResponse[], RequestError>(
|
||||
'/api/connectors'
|
||||
);
|
||||
const { data: existingConnectors, error: connectorsError } = useSWR<
|
||||
ConnectorResponse[],
|
||||
RequestError
|
||||
>('/api/connectors');
|
||||
const { data: factories, error: factoriesError } = useSWR<
|
||||
ConnectorFactoryResponse[],
|
||||
RequestError
|
||||
>('/api/connector-factories');
|
||||
const isLoading = !factories && !connectors && !connectorsError && !factoriesError;
|
||||
const isLoading = !factories && !existingConnectors && !connectorsError && !factoriesError;
|
||||
const [activeGroupId, setActiveGroupId] = useState<string>();
|
||||
const [activeFactoryId, setActiveFactoryId] = useState<string>();
|
||||
const [isGetStartedModalOpen, setIsGetStartedModalOpen] = useState(false);
|
||||
|
||||
const groups = useMemo(() => {
|
||||
if (!factories || !connectors) {
|
||||
if (!factories || !existingConnectors) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -49,10 +50,10 @@ const CreateForm = ({ onClose, isOpen: isFormOpen, type }: Props) => {
|
|||
...group,
|
||||
connectors: group.connectors.map((connector) => ({
|
||||
...connector,
|
||||
added: connectors.some(({ connectorId }) => connector.id === connectorId),
|
||||
added: existingConnectors.some(({ connectorId }) => connector.id === connectorId),
|
||||
})),
|
||||
}));
|
||||
}, [factories, type, connectors]);
|
||||
}, [factories, type, existingConnectors]);
|
||||
|
||||
const activeGroup = useMemo(
|
||||
() => groups.find(({ id }) => id === activeGroupId),
|
||||
|
|
Loading…
Add table
Reference in a new issue