Fetch all regions and find the matching label for a kraj code on an accounting unit.
Resolve a region code
Copy
Ask AI
// 1. Fetch all regionsconst { lokacie } = await fetch(`${BASE}/api/kraje`).then(r => r.json());// 2. Resolve the region label for an accounting unitconst region = lokacie.find(r => r.kod === unit.kraj);// 3. Log the region labelconsole.log(region?.nazov?.sk);