0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): navigate to the details page on connector created (#2640)

This commit is contained in:
Xiao Yijun 2022-12-13 11:41:53 +08:00 committed by GitHub
parent e8ee2a31b1
commit 89651833d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ import i18next from 'i18next';
import { FormProvider, useForm } from 'react-hook-form'; import { FormProvider, useForm } from 'react-hook-form';
import { toast } from 'react-hot-toast'; import { toast } from 'react-hot-toast';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import Close from '@/assets/images/close.svg'; import Close from '@/assets/images/close.svg';
import Button from '@/components/Button'; import Button from '@/components/Button';
@ -30,6 +31,7 @@ type Props = {
const Guide = ({ connector, onClose }: Props) => { const Guide = ({ connector, onClose }: Props) => {
const api = useApi(); const api = useApi();
const navigate = useNavigate();
const { updateSettings } = useSettings(); const { updateSettings } = useSettings();
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const { id: connectorId, type: connectorType, name, readme, isStandard } = connector; const { id: connectorId, type: connectorType, name, readme, isStandard } = connector;
@ -65,7 +67,7 @@ const Guide = ({ connector, onClose }: Props) => {
const { id: connectorId } = connector; const { id: connectorId } = connector;
await api const createdConnector = await api
.post('/api/connectors', { .post('/api/connectors', {
json: { json: {
config: result.data, config: result.data,
@ -88,6 +90,7 @@ const Guide = ({ connector, onClose }: Props) => {
onClose(); onClose();
toast.success(t('general.saved')); toast.success(t('general.saved'));
navigate(`/connectors/${createdConnector.id}`);
}); });
return ( return (