When consuming APIs in frontend applications, utilize the backend capabilities rather than reimplementing equivalent functionality in the frontend. This reduces code complexity, improves performance, and maintains a clean separation of concerns.
When consuming APIs in frontend applications, utilize the backend capabilities rather than reimplementing equivalent functionality in the frontend. This reduces code complexity, improves performance, and maintains a clean separation of concerns.
Key practices:
// PREFER const { data } = useAssetServiceGetAssets({ limit: MAX_VISIBLE, offset: 0 });
2. **Request appropriate content formats**: Use Accept headers to get data in the format best suited for your needs.
```typescript
// When raw logs are needed
useTaskInstanceServiceGetLog({
// Other parameters...
accept: "text/plain" // Get raw logs directly
});
// PREFER - Extend the backend to support this use case const { data } = useAssetServiceGetAssets({ search: searchValue }); // Searches across multiple fields ```
Following these practices leads to more maintainable code, better performance, and a clearer separation of responsibilities between frontend and backend.
Enter the URL of a public GitHub repository