JSFiddle - React, Tailwind, and code Playground

by tonytlwu

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js"></script>

JavaScript

fetch("https://us.api.fliplet.com/v1/apps/300/logs", {
    "credentials": "omit",
    "headers": {
      "accept": "application/json, text/javascript, */*; q=0.01",
      "auth-token": "us--session--35cd4b6b927fb434d8df8474f5e13daa-919-437-5407",
      "content-type": "application/json",
      "x-device-tracking": "{\"uuid\":\"11b0a03d-1d60-4f43-bc43-dd797ca81801\",\"model\":\"Browser\",\"platform\":\"MacIntel\",\"manufacturer\":\"Web\",\"version\":1,\"width\":519,\"height\":1746}",
      "x-requested-with": "XMLHttpRequest"
    },
    "referrer": "https://us.api.fliplet.com/v1/widgets/com.fliplet.analytics-report-provider/interface?organizationId=50&appId=300&providerMode=inline",
    "referrerPolicy": "no-referrer-when-downgrade",
    "body": "{\"source\":\"production\",\"where\":{\"createdAt\":{\"$gte\":1519862400000,\"$lte\":1550620800000},\"$or\":[{\"type\":\"app.analytics.event\"},{\"type\":\"app.analytics.pageView\"}],\"$and\":[]},\"order\":[[\"data._userEmail\",\"ASC\"]]}",
    "method": "POST",
    "mode": "cors"
  })
  .then(function(res) {
    return res.json();
  })
  .then(function(res) {
	  debugger;
    return _.groupBy(res.logs, function (log) {
    	return log.data._userEmail;
    });
  });