A common anti-pattern in frontend development is calling HTTP client libraries (like axios or native fetch ) directly inside Vue UI components. When components perform raw network calls, testing becomes cumbersome, endpoints cannot be reused, and frontend code is coupled to specific networking libraries.
In my recent contribution to GitLab's Contributors Platform ( MR !3201 , closing Issue #880 ), I migrated the PendingSubmissionsPill navigation component to TypeScript and extracted its API interactions into a dedicated, typed client module.
Here is an architectural walkthrough of decoupling HTTP interactions from components and testing them cleanly in Vitest.
1.…