mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 02:29:45 +00:00
23 lines
510 B
JavaScript
Executable File
23 lines
510 B
JavaScript
Executable File
import * as WPAPI from 'wpapi';
|
|
|
|
import reactPress from './reactPress';
|
|
|
|
const wp = new WPAPI(
|
|
process.env.NODE_ENV === 'development'
|
|
? {
|
|
endpoint: reactPress.api.rest_url,
|
|
username: 'admin',
|
|
password: 'testapi',
|
|
}
|
|
: { endpoint: reactPress.api.rest_url, nonce: reactPress.api.nonce }
|
|
);
|
|
|
|
export async function getContacts(q = '') {
|
|
try {
|
|
const users = await wp.users().search(q);
|
|
return users;
|
|
} catch (error) {
|
|
console.error(error);
|
|
return [];
|
|
}
|
|
} |