mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-28 09:12:37 +03:00
feat: navigate to Object Detail page after custom object creation (#2277)
Closes #2276
This commit is contained in:
parent
80a6223d7d
commit
3fc1b74d9c
@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
|
|
||||||
import { useCreateOneObject } from '@/metadata/hooks/useCreateOneObject';
|
import { useCreateOneObject } from '@/metadata/hooks/useCreateOneObject';
|
||||||
import { useMetadataObjectForSettings } from '@/metadata/hooks/useMetadataObjectForSettings';
|
import { useMetadataObjectForSettings } from '@/metadata/hooks/useMetadataObjectForSettings';
|
||||||
|
import { getObjectSlug } from '@/metadata/utils/getObjectSlug';
|
||||||
import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';
|
import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';
|
||||||
import { SettingsHeaderContainer } from '@/settings/components/SettingsHeaderContainer';
|
import { SettingsHeaderContainer } from '@/settings/components/SettingsHeaderContainer';
|
||||||
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
|
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
|
||||||
@ -63,6 +64,8 @@ export const SettingsNewObject = () => {
|
|||||||
isSelected ? activateObject({ id: standardObjectId }) : undefined,
|
isSelected ? activateObject({ id: standardObjectId }) : undefined,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
navigate('/settings/objects');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedObjectType === 'Custom') {
|
if (selectedObjectType === 'Custom') {
|
||||||
@ -78,9 +81,15 @@ export const SettingsNewObject = () => {
|
|||||||
type: ViewType.Table,
|
type: ViewType.Table,
|
||||||
name: `All ${customFormValues.labelPlural}`,
|
name: `All ${customFormValues.labelPlural}`,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
navigate('/settings/objects');
|
navigate(
|
||||||
|
createdObject.data?.createOneObject.isActive
|
||||||
|
? `/settings/objects/${getObjectSlug(
|
||||||
|
createdObject.data.createOneObject,
|
||||||
|
)}`
|
||||||
|
: '/settings/objects',
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user