“`javascript
/**
* Enhanced WordPress API Service
* Comprehensive service for all WordPress API interactions including WooCommerce
*/
import axios from ‘axios’
import {
WORDPRESS_CONFIG,
getEndpoint,
buildQueryParams,
formatWordPressDate,
getFeaturedImage,
getExcerpt
} from ‘../config/wordpress-config’
class EnhancedWordPressAPI {
constructor() {
this.cache = new Map()
this.setupAxiosInterceptors()
}
setupAxiosInterceptors() {
// Request interceptor
axios.interceptors.request.use(
(config) => {
// Add authentication headers if available
const token = localStorage.getItem(‘wp_jwt_token’)
if (token) {
config.headers.Authorization = `Bearer ${token}`
}