class PersonsManager { constructor(baseUrl) { this.baseUrl = baseUrl; } createPerson(name, age) { fetch(`${this.baseUrl}/persons/`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ name, age }), }) .then(response => response.json()) .then(data => { console.log('Person created:', data); alert('Person created successfully!'); this.fetchPersons(); // Refresh the list after creating a person }) .catch((error) => { console.error('Error:', error); }); } fetchPersons(skip = 0, limit = 100) { fetch(`${this.baseUrl}/persons/?skip=${skip}&limit=${limit}`) .then(response => response.json()) .then(data => { const personsList = document.getElementById('persons-list'); personsList.innerHTML = '