react-code-dataset / wp-calypso /client /data /notification-devices /use-notification-devices-query.js
react-code-dataset / wp-calypso /client /data /notification-devices /use-notification-devices-query.js
Download wp-calypso/client/data/notification-devices/use-notification-devices-query.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 357 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/notification-devices/use-notification-devices-query.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/notification-devices/use-notification-devices-query.js
-
curl -L -o use-notification-devices-query.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/notification-devices/use-notification-devices-query.js
357 Bytes
| import { useQuery } from '@tanstack/react-query'; | |
| import wp from 'calypso/lib/wp'; | |
| export const useNotificationDevicesQuery = () => | |
| useQuery( { | |
| queryKey: [ 'notification-devices' ], | |
| queryFn: () => wp.req.get( `/notifications/devices` ), | |
| select( data ) { | |
| return data.map( ( { device_id: id, device_name: name } ) => ( { id, name } ) ); | |
| }, | |
| } ); | |