Download wp-calypso/client/data/viewers/use-viewer-query.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 372 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/viewers/use-viewer-query.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/viewers/use-viewer-query.js
-
curl -L -o use-viewer-query.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/viewers/use-viewer-query.js
372 Bytes
| import { useQuery } from '@tanstack/react-query'; | |
| import wpcom from 'calypso/lib/wp'; | |
| const useViewerQuery = ( siteId, userId ) => { | |
| return useQuery( { | |
| queryKey: [ 'viewer', userId ], | |
| queryFn: () => | |
| wpcom.req.get( { | |
| path: `/sites/${ siteId }/viewer/${ userId }?http_envelope=1`, | |
| apiNamespace: 'rest/v1.1', | |
| } ), | |
| } ); | |
| }; | |
| export default useViewerQuery; | |