mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-24 16:33:49 +00:00
Created component decorator that resets selected server and used it on Settings
This commit is contained in:
15
src/servers/helpers/withoutSelectedServer.tsx
Normal file
15
src/servers/helpers/withoutSelectedServer.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
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} />;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user