reupload of project
This commit is contained in:
18
web/static/scripts/create_user.js
Normal file
18
web/static/scripts/create_user.js
Normal file
@@ -0,0 +1,18 @@
|
||||
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));
|
||||
}
|
||||
Reference in New Issue
Block a user