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