Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
feat: добавление проверки на авторизацию (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
DieWerkself authored Nov 7, 2023
1 parent 45554d3 commit f4878b9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pages/projects/ui/ProjectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Rating } from '~/features/user';

import { Card } from '~/entities/project';

import { useApi } from '~/shared/hooks';
import { useApi, useIsAuth } from '~/shared/hooks';
import { GoBack } from '~/shared/ui/GoBack';
import { STag } from '~/shared/ui/STag';

Expand All @@ -42,6 +42,7 @@ const dummyData = [
export const ProjectPage = () => {
const { id: projectId } = useParams();
const { projectsApi, userApi } = useApi();
const isAuth = useIsAuth();

const [ownerID, setOwnerID] = useState<string>('');

Expand All @@ -60,9 +61,9 @@ export const ProjectPage = () => {
});

const { data: myData, isLoading: meIsLoading } = useQuery({
queryKey: ['myID', ownerID],
queryKey: ['myID', ownerID, isAuth],
queryFn: () => userApi.getMe(),
enabled: !!ownerID,
enabled: !!ownerID && !!isAuth,
});

return (
Expand Down

0 comments on commit f4878b9

Please sign in to comment.