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

feat: добавление проверки на авторизацию #57

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading