From 854a5c13c42ce2ae2796fe03e26fbe2f04ce7278 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Sat, 8 Feb 2025 21:49:41 +0300 Subject: [PATCH] rename useProfile -> useProfileQuery --- apps/web/components/profile/cards/data-card.tsx | 6 +++--- apps/web/components/profile/cards/links-card.tsx | 4 ++-- apps/web/components/profile/cards/person-card.tsx | 4 ++-- apps/web/hooks/profile/index.ts | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/web/components/profile/cards/data-card.tsx b/apps/web/components/profile/cards/data-card.tsx index b36ed21..1c05ad4 100644 --- a/apps/web/components/profile/cards/data-card.tsx +++ b/apps/web/components/profile/cards/data-card.tsx @@ -1,14 +1,14 @@ 'use client'; import { type ProfileProps } from '../types'; import { CheckboxWithText, DataField, ProfileCardHeader } from './components'; -import { useProfile, useProfileMutation } from '@/hooks/profile'; +import { useProfileMutation, useProfileQuery } from '@/hooks/profile'; import { Enum_Customer_Role as Role } from '@repo/graphql/types'; import { Button } from '@repo/ui/components/ui/button'; import { Card } from '@repo/ui/components/ui/card'; import Link from 'next/link'; export function ContactDataCard({ telegramId }: Readonly) { - const { data: customer } = useProfile({ telegramId }); + const { data: customer } = useProfileQuery({ telegramId }); if (!customer) return null; @@ -29,7 +29,7 @@ export function ContactDataCard({ telegramId }: Readonly) { } export function ProfileDataCard() { - const { data: customer } = useProfile({}); + const { data: customer } = useProfileQuery({}); const { mutate: updateProfile } = useProfileMutation({}); if (!customer) return null; diff --git a/apps/web/components/profile/cards/links-card.tsx b/apps/web/components/profile/cards/links-card.tsx index 9d25cb3..74a68c0 100644 --- a/apps/web/components/profile/cards/links-card.tsx +++ b/apps/web/components/profile/cards/links-card.tsx @@ -2,11 +2,11 @@ 'use client'; import { type ProfileProps } from '../types'; import { LinkButton } from './components'; -import { useProfile } from '@/hooks/profile'; +import { useProfileQuery } from '@/hooks/profile'; import { Enum_Customer_Role } from '@repo/graphql/types'; export function LinksCard({ telegramId }: Readonly) { - const { data: customer } = useProfile({ telegramId }); + const { data: customer } = useProfileQuery({ telegramId }); const isMaster = customer?.role === Enum_Customer_Role.Master; diff --git a/apps/web/components/profile/cards/person-card.tsx b/apps/web/components/profile/cards/person-card.tsx index 77c9163..f01ceb7 100644 --- a/apps/web/components/profile/cards/person-card.tsx +++ b/apps/web/components/profile/cards/person-card.tsx @@ -1,11 +1,11 @@ 'use client'; import { type ProfileProps } from '../types'; -import { useProfile } from '@/hooks/profile'; +import { useProfileQuery } from '@/hooks/profile'; import { Avatar, AvatarFallback, AvatarImage } from '@repo/ui/components/ui/avatar'; import { Card } from '@repo/ui/components/ui/card'; export function PersonCard({ telegramId }: Readonly) { - const { data: customer } = useProfile({ telegramId }); + const { data: customer } = useProfileQuery({ telegramId }); if (!customer) return null; diff --git a/apps/web/hooks/profile/index.ts b/apps/web/hooks/profile/index.ts index 8db3e0b..b0712ed 100644 --- a/apps/web/hooks/profile/index.ts +++ b/apps/web/hooks/profile/index.ts @@ -3,7 +3,7 @@ import { getProfile, updateProfile } from '@/actions/profile'; import { type ProfileProps } from '@/components/profile/types'; import { useMutation, useQuery } from '@tanstack/react-query'; -export const useProfile = ({ telegramId }: ProfileProps) => { +export const useProfileQuery = ({ telegramId }: ProfileProps) => { return useQuery({ queryFn: () => getProfile({ telegramId }), queryKey: telegramId ? ['profile', 'telegramId', telegramId] : ['profile'], @@ -11,7 +11,7 @@ export const useProfile = ({ telegramId }: ProfileProps) => { }; export const useProfileMutation = ({ telegramId }: ProfileProps) => { - const { refetch } = useProfile({ telegramId }); + const { refetch } = useProfileQuery({ telegramId }); return useMutation({ mutationFn: updateProfile,