document.getElementById('userForm').addEventListener('submit', async (e) => {
    e.preventDefault();
  
    const data = {
      name: document.getElementById('name').value,
      email: document.getElementById('email').value,
      role: document.getElementById('role').value,
      passwordHash: 'test123' 
    };
  
    const response = await fetch('/api/users', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(data)
    });
  
    const result = await response.json();
    alert(result.message || result.error);
  });
  