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

fix(console): should navigate to details page after creating protected app (#5337)

This commit is contained in:
Charles Zhao 2024-01-30 12:36:04 +08:00 committed by GitHub
parent 7266aee445
commit ecbec3d61a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,6 +14,7 @@ import Button, { type Props as ButtonProps } from '@/ds-components/Button';
import FormField from '@/ds-components/FormField'; import FormField from '@/ds-components/FormField';
import TextInput from '@/ds-components/TextInput'; import TextInput from '@/ds-components/TextInput';
import useApi from '@/hooks/use-api'; import useApi from '@/hooks/use-api';
import useTenantPathname from '@/hooks/use-tenant-pathname';
import * as styles from './index.module.scss'; import * as styles from './index.module.scss';
@ -40,6 +41,7 @@ function ProtectedAppForm({
isDevFeaturesEnabled && isCloud && 'api/systems/application' isDevFeaturesEnabled && isCloud && 'api/systems/application'
); );
const defaultDomain = data?.protectedApps.defaultDomain ?? ''; const defaultDomain = data?.protectedApps.defaultDomain ?? '';
const { navigate } = useTenantPathname();
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const { const {
register, register,
@ -68,6 +70,7 @@ function ProtectedAppForm({
.json<Application>(); .json<Application>();
toast.success(t('applications.application_created')); toast.success(t('applications.application_created'));
onCreateSuccess?.(createdApp); onCreateSuccess?.(createdApp);
navigate(`/applications/${createdApp.id}`);
} catch (error: unknown) { } catch (error: unknown) {
if (error instanceof HTTPError) { if (error instanceof HTTPError) {
const { code, message } = await error.response.json<RequestErrorBody>(); const { code, message } = await error.response.json<RequestErrorBody>();