File size: 679 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 25 26 27 |
import wpcom from 'calypso/lib/wp';
type WpcomRegisteredStatus = {
status: string;
mappable: string;
other_site_domain?: string;
other_site_domain_only?: boolean;
};
type NonWpcomRegisteredStatus = {
status: null;
};
type WpcomRegistrationStatus = WpcomRegisteredStatus | NonWpcomRegisteredStatus;
export function getWpcomRegistrationStatus(
domainName: string,
blogId: number
): Promise< WpcomRegisteredStatus | null > {
return wpcom.req
.get( `/domains/${ encodeURIComponent( domainName ) }/get-wpcom-registration-status`, {
blog_id: blogId,
apiVersion: '1.3',
} )
.then( ( data: WpcomRegistrationStatus ) => ( data.status === null ? null : data ) );
}
|