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

16 lines
399 B
TypeScript
Raw Normal View History

import React, { 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} />;
};
}