Implement edit-player. Optimizations.

This commit is contained in:
MaxJa4
2024-01-16 20:54:49 +01:00
parent fc084108ac
commit 94e0c178f0
14 changed files with 100 additions and 35 deletions

View File

@@ -4,7 +4,7 @@
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-3 text-success fw-bold" id="editClanModalLabel">Clan bearbeiten</h1>
<h1 class="modal-title fs-3 text-primary fw-bold" id="editClanModalLabel">Clan bearbeiten</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
@@ -32,17 +32,12 @@
<script lang="javascript">
document.addEventListener('DOMContentLoaded', function() {
const editClanModal = document.getElementById('editClanModal');
const editClanModalBS = new bootstrap.Modal('#editClanModal');
if (editClanModal) {
editClanModal.addEventListener('show.bs.modal', event => {
const [clanList, otherClanList] = getClanLists(event);
const selectedClanIndex = clanList.selectedIndex;
const selectedClanItem = clanList.options[selectedClanIndex];
const otherSelClanItem = otherClanList.options[selectedClanIndex];
const clanName = editClanModal.querySelector('#editClanName');
const clanTag = editClanModal.querySelector('#editClanTag');
const keepUpdated = editClanModal.querySelector('#editKeepUpdated');
@@ -67,9 +62,7 @@
throw new Error(error);
});
submitButton.addEventListener('click', function (e) {
e.preventDefault();
submitButton.onclick = function () {}
submitButton.addEventListener('click', function () {
fetch("/clan/" + clanId, {
method: "PATCH",
body: JSON.stringify({
@@ -111,7 +104,7 @@
.catch((error) => {
throw new Error(error)
});
})
}, { once: true });
});
}
});