1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 21:06:42 +07:00

refactor comment components

This commit is contained in:
Fedor Katurov 2023-11-19 18:07:28 +06:00
parent 60da84aad9
commit eea7095e65
42 changed files with 89 additions and 76 deletions

View file

@ -0,0 +1,20 @@
import React, { FC } from 'react';
import { observer } from 'mobx-react-lite';
import { useAuth } from '~/hooks/auth/useAuth';
interface IProps {
// don't wait for user refetch, trust hydration
hydratedOnly?: boolean;
}
const Authorized: FC<IProps> = observer(({ children, hydratedOnly }) => {
const { isUser, fetched } = useAuth();
if (!isUser || (!hydratedOnly && !fetched)) return null;
return <>{children}</>;
});
export { Authorized };