Download wp-calypso/client/data/users/use-user-query.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 425 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/users/use-user-query.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/users/use-user-query.js
-
curl -L -o use-user-query.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/users/use-user-query.js
425 Bytes
| import { useQuery } from '@tanstack/react-query'; | |
| import wpcom from 'calypso/lib/wp'; | |
| export const getCacheKey = ( siteId, login ) => [ 'user', siteId, login ]; | |
| const useUserQuery = ( siteId, login, queryOptions = {} ) => { | |
| return useQuery( { | |
| queryKey: getCacheKey( siteId, login ), | |
| queryFn: () => wpcom.req.get( `/sites/${ siteId }/users/login:${ login }` ), | |
| ...queryOptions, | |
| } ); | |
| }; | |
| export default useUserQuery; | |