| 1 |
import apiFetch from '@wordpress/api-fetch'; |
| 2 |
|
| 3 |
export const query = (args) => |
| 4 |
new URLSearchParams( |
| 5 |
Object.entries(args).filter( |
| 6 |
([, value]) => value !== undefined && value !== '', |
| 7 |
), |
| 8 |
); |
| 9 |
|
| 10 |
export const restBase = async (path) => { |
| 11 |
const registered = await apiFetch({ path }).catch(() => null); |
| 12 |
return registered?.rest_base; |
| 13 |
}; |
| 14 |
|