123456789101112131415161718192021 |
- import { friendsQueryKeys } from '../friends-query-keys';
- import { type PostGetFriendsNotificationReturn, friendsApi } from '../friends-api';
- import { queryClient } from 'src/utils/queryClient';
- export const fetchFriendsNotification = async (token: string) => {
- try {
- const data: PostGetFriendsNotificationReturn = await queryClient.fetchQuery({
- queryKey: friendsQueryKeys.getNotification(token),
- queryFn: async () => {
- const response = await friendsApi.getNotification(token);
- return response.data;
- },
- gcTime: 0,
- staleTime: 0
- });
- return data;
- } catch (error) {
- console.error('Failed to fetch friends notification:', error);
- }
- };
|