File size: 704 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { useQuery } from '@tanstack/react-query';
import wpcomRequest from 'wpcom-proxy-request';
import type { SiteSlug } from 'calypso/types';

export type ScheduledUpdatesNotificationSettings = {
	success: boolean;
	failure: boolean;
};

export const useScheduledUpdatesNotificationSettingsQuery = ( siteSlug: SiteSlug ) => {
	return useQuery< ScheduledUpdatesNotificationSettings, Error >( {
		queryKey: [ 'scheduled-updates-notification-settings', siteSlug ],
		queryFn: () =>
			wpcomRequest( {
				path: `/sites/${ siteSlug }/scheduled-updates/notifications`,
				apiNamespace: 'wpcom/v2',
				method: 'GET',
			} ),
		enabled: !! siteSlug,
		retry: false,
		refetchOnWindowFocus: false,
	} );
};