bfd35905c9
- Added favicon and icon assets for the mobile app. - Implemented EmotionPicker component for selecting emotions with child options. - Created hooks for fetching emotions, feeds, and rapport data. - Established API service for handling requests and authentication. - Integrated Zustand for state management of user authentication. - Defined color palette for the application. - Set up TypeScript types for various entities including User, Emotion, and Feed. - Configured Babel and TypeScript for the mobile project. - Added package.json with necessary dependencies for Expo and React Native.
25 lines
583 B
TypeScript
25 lines
583 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import api from '@/lib/api';
|
|
import type { Feed } from '@/types';
|
|
|
|
export function useFeeds() {
|
|
return useQuery<Feed[]>({
|
|
queryKey: ['feeds'],
|
|
queryFn: async () => {
|
|
const response = await api.get('/feeds');
|
|
return response.data.data ?? response.data;
|
|
},
|
|
});
|
|
}
|
|
|
|
export function useFeed(slug: string) {
|
|
return useQuery<Feed>({
|
|
queryKey: ['feed', slug],
|
|
queryFn: async () => {
|
|
const response = await api.get(`/feeds/${slug}`);
|
|
return response.data;
|
|
},
|
|
enabled: !!slug,
|
|
});
|
|
}
|