package.cjs.react-utils.useFetchNeetoApps.useFetchNeetoApps.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
{"version":3,"file":"useFetchNeetoApps.js","names":["_neetoCist","require","_usePersistedQuery","_interopRequireDefault","_neeto_apps","_constants","_query","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","useFetchNeetoApps","options","_globalProps$user","scopedQueryKey","concat","QUERY_KEYS","NEETO_APPS_LIST","globalProps","user","id","_ref","usePersistedQuery","getCache","data","modifiedAt","expired","Date","now","NEETO_APPS_LIST_STALE_TIME","neetoAppsApi","fetch","staleTime","enabled","isNotPresent","_default","exports"],"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,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAC,sBAAA,CAA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