mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-10 02:07:26 +03:00
16 lines
399 B
TypeScript
16 lines
399 B
TypeScript
|
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} />;
|
||
|
};
|
||
|
}
|