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

export const useScheduledUpdatesVerifyPathQuery = (
	siteId: number,
	path: string,
	queryOptions = {}
): UseQueryResult< { available: boolean } > => {
	return useQuery( {
		queryKey: [ 'verify-path', siteId, path ],
		queryFn: () =>
			wpcomRequest( {
				path: `/sites/${ siteId }/scheduled-updates/verify-path-status?path=${ path }`,
				method: 'GET',
				apiNamespace: 'wpcom/v2',
			} ),
		enabled: !! siteId && !! path,
		retry: false,
		...queryOptions,
	} );
};