fix: Documentation API authentication and build script

- Added X-WP-Nonce header to docs API fetch calls in Help page
- Fixed build-production.sh to include docs/ folder (changed --exclude='*.md' to --exclude='/*.md')
- This allows root-level docs like README.md to be excluded while keeping docs/ folder
This commit is contained in:
Dwindi Ramadhana
2026-01-04 11:53:33 +07:00
parent 68c3423f50
commit 0e38b0eb5f
3 changed files with 9 additions and 1 deletions

View File

@@ -21,8 +21,12 @@ export default function DocContent({ slug }: DocContentProps) {
setError(null);
try {
const nonce = (window as any).WNW_CONFIG?.nonce || (window as any).wpApiSettings?.nonce || '';
const response = await fetch(`/wp-json/woonoow/v1/docs/${slug}`, {
credentials: 'include',
headers: {
'X-WP-Nonce': nonce,
},
});
if (!response.ok) {

View File

@@ -27,8 +27,12 @@ export default function Help() {
useEffect(() => {
const fetchDocs = async () => {
try {
const nonce = (window as any).WNW_CONFIG?.nonce || (window as any).wpApiSettings?.nonce || '';
const response = await fetch('/wp-json/woonoow/v1/docs', {
credentials: 'include',
headers: {
'X-WP-Nonce': nonce,
},
});
const data = await response.json();

View File

@@ -40,7 +40,7 @@ rsync -av --progress \
--exclude='admin-spa' \
--exclude='examples' \
--exclude='*.sh' \
--exclude='*.md' \
--exclude='/*.md' \
--exclude='archive' \
--exclude='test-*.php' \
--exclude='check-*.php' \