@devgateway/dvz-ui-react
Version:
A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.
2 lines (1 loc) • 884 B
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../conf/index.js");const g=require("../../api/commons.js");function c(t){return JSON.parse(JSON.stringify(t))}const i=process.env.VITE_REACT_APP_API_ROOT,r={},s={},f=3*60*1e3;function a(t){return Object.keys(t).map(e=>encodeURIComponent(e)+"="+encodeURIComponent(t[e])).join("&")}function l(t){const e=t,n=Date.now();if(s[e]&&n-s[e].timestamp<f)return Promise.resolve(c(s[e].data));if(r[e])return r[e].then(c);const o=g.get(t).then(u=>(s[e]={data:u,timestamp:Date.now()},c(u))).finally(()=>{delete r[e]});return r[e]=o,o}const m=({app:t,params:e})=>{const n=`${i||""}/api/${t}/categories${e?"?"+a(e):""}`;return console.log("categories==>",n),l(n)},p=({source:t,app:e,params:n})=>{const o=`${i||""}/api/${e}/stats/${t}${n?"?"+a(n):""}`;return l(o)};exports.getCategories=m;exports.getData=p;