shlink-web-client/src/servers/helpers/withoutSelectedServer.tsx

16 lines
392 B
TypeScript
Raw Normal View History

2020-11-14 00:44:26 +03:00
import { FC, useEffect } from 'react';
interface WithoutSelectedServerProps {
resetSelectedServer: Function;
}
export function withoutSelectedServer<T = {}>(WrappedComponent: FC<WithoutSelectedServerProps & T>) {
return (props: WithoutSelectedServerProps & T) => {
useEffect(() => {
props.resetSelectedServer();
}, []);
return <WrappedComponent {...props} />;
};
}