mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-10-22 05:34:11 +00:00
Expose container via provider
This commit is contained in:
@@ -1,19 +1,16 @@
|
||||
import { Button, useParsedQuery } from '@shlinkio/shlink-frontend-kit';
|
||||
import type { FC } from 'react';
|
||||
import { NoMenuLayout } from '../common/NoMenuLayout';
|
||||
import type { FCWithDeps } from '../container/utils';
|
||||
import { useDependencies } from '../container/utils';
|
||||
import { useGoBack } from '../utils/helpers/hooks';
|
||||
import type { ServerData } from './data';
|
||||
import { isServerWithId } from './data';
|
||||
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';
|
||||
|
||||
export const EditServer: FCWithDeps<any, WithSelectedServerPropsDeps> = withSelectedServer(() => {
|
||||
export const EditServer: FC = withSelectedServer(() => {
|
||||
const { editServer } = useServers();
|
||||
const { buildShlinkApiClient } = useDependencies(EditServer);
|
||||
const { selectServer, selectedServer } = useSelectedServer();
|
||||
const goBack = useGoBack();
|
||||
const { reconnect } = useParsedQuery<{ reconnect?: 'true' }>();
|
||||
@@ -25,7 +22,7 @@ export const EditServer: FCWithDeps<any, WithSelectedServerPropsDeps> = withSele
|
||||
const handleSubmit = (serverData: ServerData) => {
|
||||
editServer(selectedServer.id, serverData);
|
||||
if (reconnect === 'true') {
|
||||
selectServer({ serverId: selectedServer.id, buildShlinkApiClient });
|
||||
selectServer(selectedServer.id);
|
||||
}
|
||||
goBack();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user