Skip to content
Snippets Groups Projects
Verified Commit 53de9a1c authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Polish return.

parent 371cde56
No related branches found
No related tags found
2 merge requests!85Implement the remaining api calls to make possible to link a driver shift with a reservation.,!75Resolve "Driver shift page where driver inserts shift."
......@@ -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;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment