Merge pull request #1074 from Hexastack/1073-bug---redirection-to-visual-editor-after-creating-a-new-flow

fix(frontend): fix category redirection to the visual editor
This commit is contained in:
Med Marrouchi 2025-06-02 08:33:44 +01:00 committed by GitHub
commit 61b5765fd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,10 +34,12 @@ export const CategoryForm: FC<ComponentFormProps<ICategory>> = ({
rest.onError?.();
toast.error(error || t("message.internal_server_error"));
},
onSuccess: (category: ICategory) => {
onSuccess: ({ id }: ICategory) => {
rest.onSuccess?.();
toast.success(t("message.success_save"));
router.push(`/${RouterType.VISUAL_EDITOR}/flows/${category.id}`);
if (router.pathname.startsWith(`/${RouterType.VISUAL_EDITOR}`)) {
router.push(`/${RouterType.VISUAL_EDITOR}/flows/${id}`);
}
},
};
const { mutate: createCategory } = useCreate(EntityType.CATEGORY, options);