Services in our application are specific functionalities or data manipulations handled by objects, classes, or functions.
You can add any service as needed for third-party API integrations or app metrics collection.
Description:
The API Service, represented by the ApiClient class, enhances axios client for better error handling and easier configuration.Example Usage:
Copy
Ask AI
import { apiService } from 'services';// Making a GET requestconst data = await apiService.get('/users', { sort: { createdOn: 'desc' } });
Description:
Socket Service provides functions for managing websocket connections, including connecting, disconnecting, and handling events.Example Usage:
Copy
Ask AI
import { socketService } from 'services';// Listening for an eventsocketService.on('user:updated', (data: User) => { queryClient.setQueryData(['account'], data);});// In React componentconst onCardUpdated = () => { console.log('Card updated')};useEffect(() => { socketService.on('card:updated', onCardUpdated); return () => { socketService.off('card:updated', onCardUpdated); };}, []);
Description:
Analytics Service offers a set of functionalities for working with third-party analytics systems like Mixpanel. It can be adapted to other platforms as needed.Example Usage:
Copy
Ask AI
import { analyticsService } from 'services';// Tracking an eventanalyticsService.track('New user created', { firstName, lastName });