diff --git a/src/components/Authorization/Authorization.tsx b/src/components/Authorization/Authorization.tsx index e5323854fd8aea90ad3245752cb6422c0afb528d..77a3956ce7f5af65cfd541d9faacd72219d63a3f 100644 --- a/src/components/Authorization/Authorization.tsx +++ b/src/components/Authorization/Authorization.tsx @@ -31,11 +31,9 @@ export const withAuthorization = (allowedRoles: string[]) => < T extends WithAuthProps = WithAuthProps >( WrappedComponent: React.ComponentType<T>, -): FC<T> => { +): FC<T> => // Creating the inner component. The calculated Props type here is the where the magic happens. - const ComponentWithAuthorization: FC<T> = ( - props: Omit<T, keyof WithAuthProps>, - ) => { + (props: Omit<T, keyof WithAuthProps>) => { const [role, setRole, isLoading] = useRole(); const [isAuth] = useAuth(); console.log(`ROLE ${role} AUTH ${isAuth} LOADED ${isLoading}`); @@ -50,6 +48,3 @@ export const withAuthorization = (allowedRoles: string[]) => < <HandleIsAuth isAuth={!!isAuth} /> ); }; - - return ComponentWithAuthorization; -};