Preview:
    let zone_to_id = {};
    
    let zone_post_data = []
    // create new zones
    for (const [room, roomData] of Object.entries(MAP.rooms)) {
        zone_post_data.push({
        
                'name': room,
                'x-min': roomData.x_min,
                'x-max': roomData.x_max,
                'y-min': roomData.y_min,
                'y-max': roomData.y_max,
                'z-min': roomData.z_min,
                'z-max': roomData.z_max
        })       
    }
    
    await fetch(space_url('/zones'), {
        method: 'POST',
        headers: {
            'Content-type': 'application/json; charset=UTF-8' // Indicates the content 
        },
        body: JSON.stringify(zone_post_data)
    })
    .then(response => response.json())
    .then(response => {
        response.forEach(zone => {
            zone_to_id[zone['name']] = zone['id'];
        });        
    });
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter