// Test script to verify API connection const baseUrl = 'http://localhost:8080/Web'; async function testAuth() { console.log('Testing authentication...'); const response = await fetch(`${baseUrl}/Services/index.php/Authentication/Authenticate`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ username: 'admin', password: 'password' }), }); const data = await response.json(); console.log('Auth response:', data); if (data.isAuthenticated) { console.log('Testing resources with session token...'); const resourcesResponse = await fetch(`${baseUrl}/Services/index.php/Resources/`, { headers: { 'Content-Type': 'application/json', 'X-Booked-SessionToken': data.sessionToken, 'X-Booked-UserId': data.userId, }, }); const resourcesData = await resourcesResponse.json(); console.log('Resources response:', resourcesData); } } testAuth().catch(console.error);