JSFiddle - React, Tailwind, and code Playground

by cdeutsch

HTML

<script src="https://statuspage-production.s3.amazonaws.com/se-v2.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/sugar/1.4.1/sugar.min.js"></script>

JavaScript

var sp = new StatusPage.page({ page : 'h37656c1k6qg' });
  sp.status({
    success : function(data) {
        
      //console.log(data);
    }
  });
  sp.summary({
    success : function(data) {
        console.log(data);
        if (data && data.incidents && data.incidents.length > 0) {
            console.log('here1');
            if (data.components) {
                console.log('here2');
                //var insights = data.components.find(cc => cc.id === '0js3pq4zydpk');
                var insights = data.components.find(function(cc) {
                    return cc.id === '0js3pq4zydpk';
                });
                if (insights && insights.status != 'operational') {
                    console.log('here3');
                    alert(insights.status);
                }
            }
        }
      
    }
  });