| | |
| | | return { success: false, message: 'Invalid endpoint' }; |
| | | } |
| | | |
| | | const response = await fetch(`${jvbSettings.api}${endpoint}`, { |
| | | const response = await window.auth.fetch(`${jvbSettings.api}${endpoint}`, { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | 'X-WP-Nonce': window.auth.getNonce(), |
| | | }, |
| | | body: JSON.stringify(data) |
| | | }); |
| | | |
| | | // Add error handling to see the actual response |
| | | if (!response.ok) { |
| | | const errorText = await response.text(); |
| | | console.error('Error response:', response.status, errorText); |