All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.react-utils.useFetchNeetoApps.useFetchNeetoApps.js.map Maven / Gradle / Ivy

Go to download

A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.

There is a newer version: 4.12.3
Show newest version
{"version":3,"file":"useFetchNeetoApps.js","names":["isNotPresent","usePersistedQuery","neetoAppsApi","NEETO_APPS_LIST_STALE_TIME","QUERY_KEYS","useFetchNeetoApps","options","_globalProps$user","scopedQueryKey","concat","NEETO_APPS_LIST","globalProps","user","id","_ref","getCache","data","modifiedAt","expired","Date","now","fetch","_objectSpread","staleTime","enabled"],"sources":["../../../src/react-utils/useFetchNeetoApps/useFetchNeetoApps.js"],"sourcesContent":["import { isNotPresent } from \"neetocist\";\nimport usePersistedQuery from \"react-utils/usePersistedQuery\";\n\nimport neetoAppsApi from \"./apis/neeto_apps\";\n\nimport { NEETO_APPS_LIST_STALE_TIME } from \"../constants\";\nimport { QUERY_KEYS } from \"../constants/query\";\n\nconst useFetchNeetoApps = options => {\n  const scopedQueryKey = [\n    `${QUERY_KEYS.NEETO_APPS_LIST}-${globalProps.user?.id}`,\n  ];\n\n  const { data, modifiedAt } = usePersistedQuery.getCache(scopedQueryKey) || {};\n  const expired = modifiedAt <= Date.now() - NEETO_APPS_LIST_STALE_TIME;\n\n  return usePersistedQuery(scopedQueryKey, neetoAppsApi.fetch, {\n    staleTime: NEETO_APPS_LIST_STALE_TIME,\n    enabled: expired || isNotPresent(data),\n    ...options,\n  });\n};\n\nexport default useFetchNeetoApps;\n"],"mappings":";;;AAAA,SAASA,YAAY;AACrB,OAAOC,iBAAiB;AAExB,OAAOC,YAAY;AAEnB,SAASC,0BAA0B;AACnC,SAASC,UAAU;AAEnB,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAGC,OAAO,EAAI;EAAA,IAAAC,iBAAA;EACnC,IAAMC,cAAc,GAAG,IAAAC,MAAA,CAClBL,UAAU,CAACM,eAAe,OAAAD,MAAA,EAAAF,iBAAA,GAAII,WAAW,CAACC,IAAI,cAAAL,iBAAA,uBAAhBA,iBAAA,CAAkBM,EAAE,EACtD;EAED,IAAAC,IAAA,GAA6Bb,iBAAiB,CAACc,QAAQ,CAACP,cAAc,CAAC,IAAI,CAAC,CAAC;IAArEQ,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU;EACxB,IAAMC,OAAO,GAAGD,UAAU,IAAIE,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGjB,0BAA0B;EAErE,OAAOF,iBAAiB,CAACO,cAAc,EAAEN,YAAY,CAACmB,KAAK,EAAAC,aAAA;IACzDC,SAAS,EAAEpB,0BAA0B;IACrCqB,OAAO,EAAEN,OAAO,IAAIlB,YAAY,CAACgB,IAAI;EAAC,GACnCV,OAAO,CACX,CAAC;AACJ,CAAC;AAED,eAAeD,iBAAiB","ignoreList":[]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy