shlink-web-client/src/servers/helpers/withoutSelectedServer.tsx
2020-11-13 22:44:26 +01:00

15 lines
392 B
TypeScript

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} />;
};
}