This repository has been archived on 2025-05-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
vwa_project/web/static/scripts/create_user.js

18 lines
501 B
JavaScript

function handleCreateUser(event) {
event.preventDefault();
const form = event.target;
fetch(form.action, {
method: form.method,
body: new FormData(form),
})
.then(response => response.text())
.then(result => {
if (result === 'exists') {
alert('Uživatel s tímto uživatelským jménem již existuje.');
} else {
alert('Nový uživatel byl úspěšně vytvořen.');
window.location.reload();
}
})
.catch(error => console.error('Error:', error));
}