Restrict frontend mocking

This commit is contained in:
Zvonimir Sabljic
2024-12-30 13:39:44 +03:00
parent a0eed2b24f
commit 4e19b49ed6

View File

@@ -29,7 +29,7 @@ Concurrently is used to run both client and server together with a single comman
** IMPORTANT - Mocking data on the frontend **
All API requests from the frontend to the backend must be defined in files inside the api folder (you must never make requests directly from the components) and the data must be mocked during the frontend implementation. Make sure to always add an API request whenever something needs to be sent or fetched from the backend.
When you add mock data, make sure to mock the data in files in the `client/src/api` folder and above each mocked API request, add a structure that is expected from the API with fields `Description`, `Endpoint`, `Request`, and `Response`.
When you add mock data, make sure to mock the data in files in the `client/src/api` folder and above each mocked API request, add a structure that is expected from the API with fields `Description`, `Endpoint`, `Request`, and `Response`. You **MUST NOT** add mock data anywhere else in the frontend codebase.
Mocking example:
The base client/src/api/api.ts is already created so here are 2 examples for how to write functions to get data from the backend with the mock data: