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);
|
||||
|
||||
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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user