refactor(integrations): make onSuccess required and simplify new page
- Make onSuccess a required prop on NewIntegrationForm so the consumer always controls post-creation behavior. Remove internal router.push. - Add IntegrationNewFormWrapper client component to handle navigation for the server-rendered manage page. - Replace IntegrationPickerPage with a simple "back to overview" button when an invalid integration kind is provided. Delete unused integration-picker-page.tsx.
This commit is contained in:
4 files changed
+101
-83
No files matched your search
@@ -1,25 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import type { IntegrationKind } from "@homarr/definitions";
|
||||
|
||||
import { IntegrationSelectGrid } from "./integration-select-grid";
|
||||
|
||||
interface IntegrationPickerPageProps {
|
||||
enableMockIntegration: boolean;
|
||||
}
|
||||
|
||||
export const IntegrationPickerPage = ({ enableMockIntegration }: IntegrationPickerPageProps) => {
|
||||
const router = useRouter();
|
||||
|
||||
const handleSelect = useCallback(
|
||||
(kind: IntegrationKind) => {
|
||||
router.push(`/manage/integrations/new?kind=${kind}`);
|
||||
},
|
||||
[router],
|
||||
);
|
||||
|
||||
return <IntegrationSelectGrid onSelect={handleSelect} enableMockIntegration={enableMockIntegration} />;
|
||||
};
|
||||
Reference in new issue
Block a user