rename useProfile -> useProfileQuery

This commit is contained in:
vchikalkin 2025-02-08 21:49:41 +03:00
parent 8407a4e4c4
commit 854a5c13c4
4 changed files with 9 additions and 9 deletions

View File

@ -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<ProfileProps>) {
const { data: customer } = useProfile({ telegramId });
const { data: customer } = useProfileQuery({ telegramId });
if (!customer) return null;
@ -29,7 +29,7 @@ export function ContactDataCard({ telegramId }: Readonly<ProfileProps>) {
}
export function ProfileDataCard() {
const { data: customer } = useProfile({});
const { data: customer } = useProfileQuery({});
const { mutate: updateProfile } = useProfileMutation({});
if (!customer) return null;

View File

@ -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<ProfileProps>) {
const { data: customer } = useProfile({ telegramId });
const { data: customer } = useProfileQuery({ telegramId });
const isMaster = customer?.role === Enum_Customer_Role.Master;

View File

@ -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<ProfileProps>) {
const { data: customer } = useProfile({ telegramId });
const { data: customer } = useProfileQuery({ telegramId });
if (!customer) return null;

View File

@ -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,