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:
@@ -21,8 +21,12 @@ export default function DocContent({ slug }: DocContentProps) {
|
|||||||
setError(null);
|
setError(null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const nonce = (window as any).WNW_CONFIG?.nonce || (window as any).wpApiSettings?.nonce || '';
|
||||||
const response = await fetch(`/wp-json/woonoow/v1/docs/${slug}`, {
|
const response = await fetch(`/wp-json/woonoow/v1/docs/${slug}`, {
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
|
headers: {
|
||||||
|
'X-WP-Nonce': nonce,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
@@ -27,8 +27,12 @@ export default function Help() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchDocs = async () => {
|
const fetchDocs = async () => {
|
||||||
try {
|
try {
|
||||||
|
const nonce = (window as any).WNW_CONFIG?.nonce || (window as any).wpApiSettings?.nonce || '';
|
||||||
const response = await fetch('/wp-json/woonoow/v1/docs', {
|
const response = await fetch('/wp-json/woonoow/v1/docs', {
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
|
headers: {
|
||||||
|
'X-WP-Nonce': nonce,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ rsync -av --progress \
|
|||||||
--exclude='admin-spa' \
|
--exclude='admin-spa' \
|
||||||
--exclude='examples' \
|
--exclude='examples' \
|
||||||
--exclude='*.sh' \
|
--exclude='*.sh' \
|
||||||
--exclude='*.md' \
|
--exclude='/*.md' \
|
||||||
--exclude='archive' \
|
--exclude='archive' \
|
||||||
--exclude='test-*.php' \
|
--exclude='test-*.php' \
|
||||||
--exclude='check-*.php' \
|
--exclude='check-*.php' \
|
||||||
|
|||||||
Reference in New Issue
Block a user