PHP 8.2.30
Preview: use-resource.ts Size: 642 B
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/src/frontend/hooks/use-resource/use-resource.ts

import { useSelector } from 'react-redux'

import { ResourceJSON } from '../../interfaces/resource-json.interface.js'
import { ReduxState } from '../../store/store.js'

/**
 * @load ./use-resource.doc.md
 * @subcategory Hooks
 * @class
 * @hideconstructor
 * @bundle
 * @param {string} resourceId    Id of a resource you want to get
 */
const useResource = (resourceId: string): ResourceJSON | undefined => {
  const resources = useSelector((state: ReduxState) => state.resources)

  const foundResource = resources.find((resource) => resource.id === resourceId)

  return foundResource
}

export {
  useResource as default,
  useResource,
}

Directory Contents

Dirs: 0 × Files: 3

Name Size Perms Modified Actions
34 B lrw-r--r-- 2026-02-28 00:32:28
Edit Download
356 B lrw-r--r-- 2026-02-28 00:31:58
Edit Download
642 B lrw-r--r-- 2026-02-28 00:32:46
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).