in apps/meeting/src/containers/MeetingForm/RegionSelection.tsx [24:47]
async function getNearestRegion() {
if (region) {
return;
}
try {
const res = await fetch('https://nearest-media-region.l.chime.aws', {
method: 'GET',
});
if (!res.ok) {
throw new Error('Server error');
}
const data = await res.json();
const nearestRegion = data.region;
if (mounted) {
setRegion((region: string) => region || nearestRegion);
}
} catch (e) {
console.error('Could not fetch nearest region: ', (e as Error).message);
}
}