0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-20 21:32:31 -05:00

fix(console): jump to enabled connector (#1225)

This commit is contained in:
Wang Sijie 2022-06-24 14:32:23 +08:00 committed by GitHub
parent a8467fd093
commit 833436ad15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,16 +19,17 @@ type Props = {
const ConnectorRow = ({ type, connectors, onClickSetup }: Props) => {
const { t } = useTranslation(undefined);
const inUse = useConnectorInUse(type, connectors[0]?.target);
const firstEnabledConnector = connectors.find(({ enabled }) => enabled);
const inUse = useConnectorInUse(type, firstEnabledConnector?.target);
const navigate = useNavigate();
const showSetupButton = type !== ConnectorType.Social && !connectors[0];
const showSetupButton = type !== ConnectorType.Social && !firstEnabledConnector;
const handleClickRow = () => {
if (showSetupButton || !connectors[0]) {
if (showSetupButton || !firstEnabledConnector) {
return;
}
navigate(`/connectors/${connectors[0].id}`);
navigate(`/connectors/${firstEnabledConnector.id}`);
};
return (