This commit is contained in:
ifraimka1 committed 2024-02-14 11:15:57 +03:00
1 parent f9764adef7
commit 72f6ce54b0
37 files changed
+236 -39

No files matched your search

Executable
+21
View File
@@ -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 [];
}
}