Files
shlink-web-client/src/servers/helpers/withoutSelectedServer.tsx
2023-02-18 10:40:37 +01:00

18 lines
458 B
TypeScript

import type { FC } from 'react';
import { useEffect } from 'react';
interface WithoutSelectedServerProps {
resetSelectedServer: Function;
}
export function withoutSelectedServer<T = {}>(WrappedComponent: FC<WithoutSelectedServerProps & T>) {
return (props: WithoutSelectedServerProps & T) => {
const { resetSelectedServer } = props;
useEffect(() => {
resetSelectedServer();
}, []);
return <WrappedComponent {...props} />;
};
}