2021-09-03 11:21:43 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { HTTPClientFactory } from '@woocommerce/api';
|
2022-08-29 02:36:36 +00:00
|
|
|
import config from 'config';
|
2021-09-03 11:21:43 +00:00
|
|
|
|
|
|
|
// Prepare the HTTP client that will be consumed by the repository.
|
|
|
|
// This is necessary so that it can make requests to the REST API.
|
2022-08-29 02:36:36 +00:00
|
|
|
const admin = config.get< {
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
} >( 'users.admin' );
|
|
|
|
const url = config.get< string >( 'url' );
|
2021-09-03 11:21:43 +00:00
|
|
|
|
|
|
|
export const httpClient = HTTPClientFactory.build( url )
|
|
|
|
.withBasicAuth( admin.username, admin.password )
|
|
|
|
.create();
|