File size: 610 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import wpcom from 'calypso/lib/wp';
import { DomainsApiError, SetDomainNoticeResponseDataSuccess } from './types';
export function setDomainNotice(
domainName: string,
noticeType: string,
noticeValue: string,
onComplete?: ( data: SetDomainNoticeResponseDataSuccess ) => void,
onError?: ( error: DomainsApiError ) => void
) {
wpcom.req
.post(
{ path: `/me/domains/${ domainName }/notices/${ noticeType }/message` },
{ notice_message: noticeValue }
)
.then( ( data: SetDomainNoticeResponseDataSuccess ) => onComplete?.( data ) )
.catch( ( error: DomainsApiError ) => onError?.( error ) );
}
|