| 1 |
import apiFetch from '@wordpress/api-fetch'; |
| 2 |
|
| 3 |
const routes = { |
| 4 |
enabled: '/extendify/v1/search-indexing/enable', |
| 5 |
disabled: '/extendify/v1/search-indexing/disable', |
| 6 |
}; |
| 7 |
|
| 8 |
export default async ({ indexing }) => { |
| 9 |
const path = routes[indexing]; |
| 10 |
if (!path) { |
| 11 |
throw new Error('Indexing not allowed'); |
| 12 |
} |
| 13 |
return await apiFetch({ path, method: 'POST' }); |
| 14 |
}; |
| 15 |
|