mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 04:19:45 +00:00
api
This commit is contained in:
1 parent
f9764adef7
commit
72f6ce54b0
37 files changed
+236
-39
No files matched your search
Executable
+21
@@ -0,0 +1,21 @@
|
||||
import * as WPAPI from 'wpapi';
|
||||
|
||||
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 [];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user