The account page of Byte's fish shop has a badge: "Byte — 2 orders, 1350 total". The data lives on the server in two places:
GET /api/users/<id> — the customer { id, name };GET /api/users/<id>/orders — their orders [{ id, sum }].
Write an async function loadUserOrders(userId) that returns { name, orders, total }: the customer's name, the number of orders and the sum of all sum values.
Rules:
- send both requests right away, without waiting for the first one — the test checks how many requests went out immediately after the call;
- if any response isn't successful (res.ok (opens in a new tab) is false), throw
new Error("HTTP <status>"), for example HTTP 404.