File size: 642 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { useQuery } from '@tanstack/react-query';
import wp from 'calypso/lib/wp';
import type { DomainAnalyzerWhoisRawDataQueryResponse } from 'calypso/data/site-profiler/types';

export const useDomainAnalyzerWhoisRawDataQuery = ( domain: string, enableFetch: boolean ) => {
	return useQuery( {
		queryKey: [ 'whois-domain-', domain ],
		queryFn: (): Promise< DomainAnalyzerWhoisRawDataQueryResponse > =>
			wp.req.get( {
				path: '/site-profiler/whois/' + encodeURIComponent( domain ),
				apiNamespace: 'wpcom/v2',
			} ),
		meta: {
			persist: false,
		},
		enabled: enableFetch,
		retry: false,
		refetchOnWindowFocus: false,
	} );
};