Do not inject servers state or actions

This commit is contained in:
Alejandro Celaya
2025-11-14 19:23:48 +01:00
parent ae7aea0e2c
commit a7f2d3224b
38 changed files with 292 additions and 375 deletions

View File

@@ -1,7 +1,7 @@
import { Button, useParsedQuery } from '@shlinkio/shlink-frontend-kit';
import { NoMenuLayout } from '../common/NoMenuLayout';
import type { FCWithDeps } from '../container/utils';
import { componentFactory, useDependencies } from '../container/utils';
import { useDependencies } from '../container/utils';
import { useGoBack } from '../utils/helpers/hooks';
import type { ServerData } from './data';
import { isServerWithId } from './data';
@@ -9,12 +9,10 @@ import { ServerForm } from './helpers/ServerForm';
import type { WithSelectedServerPropsDeps } from './helpers/withSelectedServer';
import { withSelectedServer } from './helpers/withSelectedServer';
import { useSelectedServer } from './reducers/selectedServer';
import { useServers } from './reducers/servers';
type EditServerProps = {
editServer: (serverId: string, serverData: ServerData) => void;
};
const EditServer: FCWithDeps<EditServerProps, WithSelectedServerPropsDeps> = withSelectedServer(({ editServer }) => {
export const EditServer: FCWithDeps<any, WithSelectedServerPropsDeps> = withSelectedServer(() => {
const { editServer } = useServers();
const { buildShlinkApiClient } = useDependencies(EditServer);
const { selectServer, selectedServer } = useSelectedServer();
const goBack = useGoBack();
@@ -45,5 +43,3 @@ const EditServer: FCWithDeps<EditServerProps, WithSelectedServerPropsDeps> = wit
</NoMenuLayout>
);
});
export const EditServerFactory = componentFactory(EditServer, ['ServerError']);