added web and fix some problems
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 9s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 14s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Failing after 8s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 9s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 14s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Failing after 8s
This commit is contained in:
1 parent
ccfc8b535e
commit
155c259ea9
29 files changed
+946
-119
No files matched your search
@@ -0,0 +1,41 @@
|
||||
const userstablebody = document.querySelector('#alluserstablebody')
|
||||
const confirmform = document.querySelector('.confirmform')
|
||||
const confirmformcancel = document.querySelector('#no')
|
||||
const confirmformok = document.querySelector('#yes')
|
||||
|
||||
let useridtodelete = "";
|
||||
|
||||
userstablebody.addEventListener('click', e => {
|
||||
if (e.target.classList.contains('deleteuser')) {
|
||||
useridtodelete = e.target.id
|
||||
confirmform.classList.add("active")
|
||||
}
|
||||
if (e.target.classList.contains('changepassword')) {
|
||||
change_password(e.target.id)
|
||||
}
|
||||
if (e.target.classList.contains('changeuser')) {
|
||||
change_user_data(parseInt(e.target.id))
|
||||
}
|
||||
})
|
||||
|
||||
confirmformcancel.addEventListener('click', () => {
|
||||
useridtodelete = ""
|
||||
confirmform.classList.remove('active')
|
||||
})
|
||||
|
||||
confirmformok.addEventListener('click', async () => {
|
||||
const status = await fetch(routes.deluser(), {
|
||||
method: 'DELETE',
|
||||
body: `{"token":"${localStorage.getItem('token')}","userid":${useridtodelete}}`
|
||||
}).then(data => data.json()).then(jsondata => jsondata).catch((error) => {
|
||||
notification(`Ошибка на сервере: ${error}`, "error")
|
||||
})
|
||||
if (status.success) {
|
||||
confirmform.classList.remove('active')
|
||||
await get_all_users()
|
||||
notification("Пользователь успешно удален", "success")
|
||||
} else {
|
||||
notification("Can't delete user", "error")
|
||||
confirmform.classList.remove('active')
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user