Переписаны модули, тесты, обработка ошибок

This commit is contained in:
Халимов Рустам
2026-03-10 21:08:25 +03:00
parent 878934e705
commit 144f200781
87 changed files with 4363 additions and 1792 deletions
+29
View File
@@ -0,0 +1,29 @@
import { api } from './axios';
import { useQuery } from '@tanstack/react-query';
export interface PublicProfile {
id: string;
fullName: string | null;
avatarUrl: string | null;
primaryRole: string;
}
/**
* Получение публичной информации о пользователе
*/
export const getPublicProfile = async (userId: string): Promise<PublicProfile> => {
const response = await api.get<PublicProfile>(`/profile/public/${userId}`);
return response.data;
};
/**
* Хук для получения публичного профиля
*/
export const usePublicProfile = (userId: string | undefined) => {
return useQuery({
queryKey: ['publicProfile', userId],
queryFn: () => getPublicProfile(userId!),
enabled: !!userId,
staleTime: 10 * 60 * 1000, // 10 минут
});
};