File size: 357 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
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 } ) );
		},
	} );