mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-02 05:36:38 +00:00
18 lines
492 B
TypeScript
18 lines
492 B
TypeScript
import type { FC } from 'react';
|
|
import { useEffect } from 'react';
|
|
|
|
interface WithoutSelectedServerProps {
|
|
resetSelectedServer: () => unknown;
|
|
}
|
|
|
|
export function withoutSelectedServer<T extends object>(WrappedComponent: FC<WithoutSelectedServerProps & T>) {
|
|
return (props: WithoutSelectedServerProps & T) => {
|
|
const { resetSelectedServer } = props;
|
|
useEffect(() => {
|
|
resetSelectedServer();
|
|
}, [resetSelectedServer]);
|
|
|
|
return <WrappedComponent {...props} />;
|
|
};
|
|
}
|