Visitors come from everywhere. A select next to the filters shows every price in EUR, GBP, USD or CHF, using today's rates from the Frankfurter API (public, no key, CORS enabled). The server's prices stay in euros; the conversion is display only. ★☆☆
“Is €12 for a record a lot? What's that in pounds?”
You'll demo (next class): switch to GBP: every price changes, with the right currency symbol and decimals. Switch again: no new request. Reload: the choice is remembered.
Four things, on top of your connected market. They count when they work with chaos on (control page).
GET to Frankfurter for today's rates.Intl.NumberFormat; "free" stays "free".What has to work for the demo next class, not how. The core above is part of it.
GET https://api.frankfurter.dev/v1/latest?base=EUR&symbols=GBP,USD,CHF, cached for the day.localStorage.Intl.NumberFormat, not string concatenation.localStorage falls back to EUR.New tool: Intl.NumberFormat with style: "currency".
navigator.language.Network panel first: is the request sent, with what, and what came back? Then a hint.
Is the converted price state, or derived from state?
Where should the conversion happen: in card(), or before the data reaches it?
This brief assumes Connect the market is done: api.js works, the stalls come from the API, loading and errors are handled. Then: The Frankfurter request is in the Network panel and rates.GBP is in the console.