Sync both clan lists.
This commit is contained in:
@@ -31,6 +31,21 @@ func GetAllClans(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, clans)
|
||||
}
|
||||
|
||||
// GetAllClanOptions GET /clan_options
|
||||
func GetAllClanOptions(c *gin.Context) {
|
||||
var clans []models.Clan
|
||||
models.DB.Find(&clans)
|
||||
|
||||
var htmlOptions string
|
||||
htmlOptions = `<option disabled selected value>Auswählen...</option>`
|
||||
for _, clan := range clans {
|
||||
htmlOptions += fmt.Sprintf(`<option value="%d">[%s] %s</option>`, clan.ID, clan.Tag, clan.Name)
|
||||
}
|
||||
|
||||
c.Header("Content-Type", "text/html")
|
||||
c.String(http.StatusOK, htmlOptions)
|
||||
}
|
||||
|
||||
// AddClan POST /clan
|
||||
func AddClan(c *gin.Context) {
|
||||
var input AddClanInput
|
||||
|
||||
BIN
isc_data.db
BIN
isc_data.db
Binary file not shown.
106
isc_rest.log
106
isc_rest.log
@@ -52,3 +52,109 @@ Deleted clan 'safdsdfafd' with tag 'asdfasdfsdf'
|
||||
[GIN] 2024/01/14 - 21:49:32 | 200 | 75.1µs | 127.0.0.1 | GET "/players"
|
||||
[GIN] 2024/01/14 - 21:50:57 | 200 | 1.1241ms | 127.0.0.1 | GET "/"
|
||||
[GIN] 2024/01/14 - 22:05:47 | 200 | 1.1526ms | 127.0.0.1 | GET "/"
|
||||
[GIN] 2024/01/15 - 09:55:07 | 200 | 2.5532ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 09:55:07 | 200 | 31.8818ms | ::1 | GET "/static/index.css"
|
||||
[GIN] 2024/01/15 - 09:55:07 | 404 | 0s | ::1 | GET "/favicon.ico"
|
||||
[GIN] 2024/01/15 - 09:55:19 | 200 | 79.4µs | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 09:56:19 | 200 | 1.0013ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 09:56:19 | 200 | 548.6µs | ::1 | GET "/static/index.js"
|
||||
[GIN] 2024/01/15 - 09:56:20 | 200 | 187.6µs | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 09:56:22 | 200 | 687.1µs | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 09:56:23 | 200 | 1.0003ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 09:59:53 | 200 | 0s | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 10:00:08 | 200 | 848.8µs | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 10:02:47 | 200 | 1.295ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:02:47 | 304 | 0s | ::1 | GET "/static/index.js"
|
||||
[GIN] 2024/01/15 - 10:02:52 | 200 | 785.3µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:03:16 | 200 | 1.4718ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:03:17 | 200 | 2.6971ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:03:18 | 200 | 0s | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:03:23 | 200 | 695µs | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 10:07:23 | 200 | 999.7µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:07:23 | 304 | 0s | ::1 | GET "/static/index.js"
|
||||
[GIN] 2024/01/15 - 10:07:26 | 200 | 966µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:07:35 | 200 | 1.1975ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:07:58 | 200 | 921.1µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:08:18 | 200 | 504µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:08:20 | 200 | 738.1µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:08:20 | 200 | 32.1015ms | ::1 | GET "/static/index.css"
|
||||
[GIN] 2024/01/15 - 10:08:20 | 200 | 32.1015ms | ::1 | GET "/static/index.js"
|
||||
[GIN] 2024/01/15 - 10:08:21 | 404 | 0s | ::1 | GET "/favicon.ico"
|
||||
[GIN] 2024/01/15 - 10:08:23 | 200 | 1.0003ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:09:12 | 200 | 393.6µs | ::1 | GET "/clans"
|
||||
[GIN] 2024/01/15 - 10:09:24 | 200 | 386.1µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:09:36 | 200 | 249.7µs | ::1 | GET "/clans"
|
||||
[GIN] 2024/01/15 - 10:09:38 | 200 | 728.4µs | ::1 | GET "/clans"
|
||||
[GIN] 2024/01/15 - 10:09:39 | 200 | 510.8µs | ::1 | GET "/clans"
|
||||
[GIN] 2024/01/15 - 10:09:50 | 200 | 938.7µs | ::1 | GET "/clans"
|
||||
[GIN] 2024/01/15 - 10:09:55 | 200 | 101.5µs | ::1 | GET "/clans"
|
||||
[GIN] 2024/01/15 - 10:09:59 | 200 | 552.2µs | ::1 | GET "/clans"
|
||||
[GIN] 2024/01/15 - 10:14:57 | 200 | 1.3826ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:14:57 | 304 | 0s | ::1 | GET "/static/index.js"
|
||||
[GIN] 2024/01/15 - 10:15:03 | 200 | 614.5µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:15:14 | 200 | 345.9µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:15:46 | 200 | 1.5371ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:15:46 | 200 | 32.727ms | ::1 | GET "/static/index.css"
|
||||
[GIN] 2024/01/15 - 10:15:46 | 200 | 32.727ms | ::1 | GET "/static/index.js"
|
||||
[GIN] 2024/01/15 - 10:15:47 | 404 | 0s | ::1 | GET "/favicon.ico"
|
||||
[GIN] 2024/01/15 - 10:15:53 | 200 | 142.4µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:16:11 | 200 | 1.0272ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:16:16 | 200 | 849.7µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:18:18 | 200 | 427.3µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:18:18 | 304 | 301.7µs | ::1 | GET "/static/index.js"
|
||||
[GIN] 2024/01/15 - 10:18:18 | 200 | 541.7µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:18:25 | 200 | 1.4775ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:18:25 | 200 | 937.3µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:03 | 200 | 1.0007ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:19:03 | 200 | 603.9µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:03 | 200 | 71.5µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:08 | 200 | 999.9µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:19:08 | 200 | 831.5µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:08 | 200 | 1.254ms | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:08 | 200 | 1.9087ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:19:08 | 200 | 211.1µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:08 | 200 | 403µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:09 | 200 | 607.6µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:19:09 | 200 | 226.1µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:09 | 200 | 146.4µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:13 | 200 | 1.3485ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:19:13 | 200 | 938.6µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:19:13 | 200 | 1.0501ms | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:26:17 | 200 | 516.5µs | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:26:17 | 304 | 581.2µs | ::1 | GET "/static/index.js"
|
||||
[GIN] 2024/01/15 - 10:26:18 | 200 | 552µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:26:18 | 200 | 379.7µs | ::1 | GET "/clan_options"
|
||||
Added clan 'testinger' with tag 'asd'
|
||||
[GIN] 2024/01/15 - 10:26:24 | 200 | 2.1851ms | ::1 | POST "/clan"
|
||||
[GIN] 2024/01/15 - 10:26:24 | 200 | 551.3µs | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 10:27:54 | 200 | 1.4677ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:27:54 | 200 | 520.6µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:27:54 | 200 | 471µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:27:57 | 200 | 764.4µs | ::1 | GET "/players"
|
||||
Deleted clan 'testinger' with tag 'asd'
|
||||
[GIN] 2024/01/15 - 10:27:58 | 200 | 1.8567ms | ::1 | DELETE "/clan/14"
|
||||
[GIN] 2024/01/15 - 10:27:58 | 200 | 940.8µs | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 10:27:59 | 200 | 950.2µs | ::1 | GET "/players"
|
||||
Deleted clan 'ewerqer' with tag 'werwqer'
|
||||
[GIN] 2024/01/15 - 10:28:01 | 200 | 18.0168ms | ::1 | DELETE "/clan/13"
|
||||
[GIN] 2024/01/15 - 10:28:01 | 200 | 112µs | ::1 | GET "/players"
|
||||
Deleted clan 'ewerqer' with tag 'werwqer'
|
||||
[GIN] 2024/01/15 - 10:28:01 | 200 | 31.2637ms | ::1 | DELETE "/clan/13"
|
||||
[GIN] 2024/01/15 - 10:28:01 | 200 | 999.4µs | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 10:28:03 | 200 | 1.2154ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:28:03 | 200 | 519µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:28:03 | 200 | 1.103ms | ::1 | GET "/clan_options"
|
||||
Added clan '12333' with tag '12333'
|
||||
[GIN] 2024/01/15 - 10:28:08 | 200 | 2.6491ms | ::1 | POST "/clan"
|
||||
[GIN] 2024/01/15 - 10:28:08 | 200 | 966.7µs | ::1 | GET "/players"
|
||||
[GIN] 2024/01/15 - 10:30:21 | 200 | 1.0749ms | ::1 | GET "/"
|
||||
[GIN] 2024/01/15 - 10:30:21 | 304 | 362.4µs | ::1 | GET "/static/index.js"
|
||||
[GIN] 2024/01/15 - 10:30:21 | 200 | 993.8µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:30:21 | 200 | 167.3µs | ::1 | GET "/clan_options"
|
||||
[GIN] 2024/01/15 - 10:30:24 | 200 | 962.3µs | ::1 | GET "/players"
|
||||
Added clan 'zrdz' with tag 'zrdz'
|
||||
[GIN] 2024/01/15 - 10:30:28 | 200 | 1.3631ms | ::1 | POST "/clan"
|
||||
[GIN] 2024/01/15 - 10:30:28 | 200 | 0s | ::1 | GET "/players"
|
||||
Added clan 'zrdz' with tag 'zrdz'
|
||||
[GIN] 2024/01/15 - 10:30:28 | 200 | 7.0468ms | ::1 | POST "/clan"
|
||||
[GIN] 2024/01/15 - 10:30:28 | 200 | 489.7µs | ::1 | GET "/players"
|
||||
|
||||
1
main.go
1
main.go
@@ -61,6 +61,7 @@ func main() {
|
||||
})
|
||||
|
||||
router.GET("/clans", controllers.GetAllClans)
|
||||
router.GET("/clan_options", controllers.GetAllClanOptions)
|
||||
router.GET("/clan/:id", controllers.GetClanByID)
|
||||
router.POST("/clan", controllers.AddClan)
|
||||
router.PATCH("/clan/:id", controllers.UpdateClanByID)
|
||||
|
||||
25
static/index.js
Normal file
25
static/index.js
Normal file
@@ -0,0 +1,25 @@
|
||||
function setupClanButtons(dropdownId, delBtnId, editBtnId) {
|
||||
const dropdown = document.getElementById(dropdownId);
|
||||
const deleteButton = document.getElementById(delBtnId);
|
||||
const editButton = document.getElementById(editBtnId);
|
||||
|
||||
dropdown.addEventListener('change', function () {
|
||||
deleteButton.disabled = !this.value;
|
||||
editButton.disabled = !this.value;
|
||||
});
|
||||
}
|
||||
|
||||
function getClanLists(event) {
|
||||
const button = event.relatedTarget;
|
||||
const clanListId = button.getAttribute('data-bs-list');
|
||||
const clanList = document.querySelector(clanListId);
|
||||
|
||||
let otherClanListId;
|
||||
if (clanListId === '#home-clan')
|
||||
otherClanListId = '#opponent-clan'
|
||||
else
|
||||
otherClanListId = '#home-clan'
|
||||
const otherClanList = document.querySelector(otherClanListId);
|
||||
|
||||
return [clanList, otherClanList];
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Infantry Skill Calculator</title>
|
||||
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
||||
<script src="../static/index.js"></script>
|
||||
<!-- Bootstrap 5 CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
<div class="input-group input-group-lg mb-3">
|
||||
<select class="form-select form-control border-secondary" id="home-clan" hx-get="/players" hx-target="#home-player-list">
|
||||
<option disabled selected value>Auswählen...</option>
|
||||
{{ range .clans }}
|
||||
<option value="{{ .ID }}">[{{ .Tag }}] {{ .Name }}</option>
|
||||
{{ end }}
|
||||
<!-- Options will be loaded dynamically -->
|
||||
</select>
|
||||
<button class="btn btn-lg btn-outline-secondary text-danger" type="button" id="home-delete" data-bs-toggle="modal" data-bs-list="#home-clan" data-bs-target="#deleteClanModal" disabled>
|
||||
<i class="bi bi-trash3"></i>
|
||||
@@ -27,14 +25,8 @@
|
||||
|
||||
<script lang="javascript">
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const dropdownHome = document.getElementById('home-clan');
|
||||
const deleteButtonHome = document.getElementById('home-delete');
|
||||
const editButtonHome = document.getElementById('home-edit');
|
||||
|
||||
dropdownHome.addEventListener('change', function () {
|
||||
deleteButtonHome.disabled = !this.value;
|
||||
editButtonHome.disabled = !this.value;
|
||||
});
|
||||
setupClanButtons('home-clan', 'home-delete', 'home-edit');
|
||||
htmx.ajax('GET', '/clan_options', {target: '#home-clan'});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
<div class="input-group input-group-lg mb-3">
|
||||
<select class="form-select form-control border-secondary" id="opponent-clan" hx-get="/players" hx-target="#opponent-player-list">
|
||||
<option disabled selected value>Auswählen...</option>
|
||||
{{ range .clans }}
|
||||
<option value="{{ .ID }}">[{{ .Tag }}] {{ .Name }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
<button class="btn btn-lg btn-outline-secondary text-danger" type="button" id="opponent-delete" data-bs-toggle="modal" data-bs-list="#opponent-clan" data-bs-target="#deleteClanModal" disabled>
|
||||
<i class="bi bi-trash3"></i>
|
||||
@@ -27,14 +24,8 @@
|
||||
|
||||
<script lang="javascript">
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const dropdownOpponent = document.getElementById('opponent-clan');
|
||||
const deleteButtonOpponent = document.getElementById('opponent-delete');
|
||||
const editButtonOpponent = document.getElementById('opponent-edit');
|
||||
|
||||
dropdownOpponent.addEventListener('change', function () {
|
||||
deleteButtonOpponent.disabled = !this.value;
|
||||
editButtonOpponent.disabled = !this.value;
|
||||
});
|
||||
setupClanButtons('opponent-clan', 'opponent-delete', 'opponent-edit');
|
||||
htmx.ajax('GET', '/clan_options', {target: '#opponent-clan'});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -36,10 +36,11 @@
|
||||
if (addClanModal) {
|
||||
addClanModal.addEventListener('shown.bs.modal', event => {
|
||||
const submitButton = addClanModal.querySelector('button[name="submit"]');
|
||||
submitButton.addEventListener('click', function () {
|
||||
const button = event.relatedTarget;
|
||||
const clanListId = button.getAttribute('data-bs-list');
|
||||
const clanList = document.querySelector(clanListId);
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
submitButton.onclick = function () {}
|
||||
|
||||
const [clanList, otherClanList] = getClanLists(event);
|
||||
|
||||
const clanName = addClanModal.querySelector('#clanName');
|
||||
const clanTag = addClanModal.querySelector('#clanTag');
|
||||
@@ -61,9 +62,15 @@
|
||||
const opt = document.createElement('option');
|
||||
opt.innerText = "[" + clanTag.value + "]" + " " + clanName.value;
|
||||
opt.value = response.json()['ID'];
|
||||
clanList.appendChild(opt);
|
||||
|
||||
clanList.appendChild(opt.cloneNode(true));
|
||||
clanList.selectedIndex = clanList.children.length - 1;
|
||||
clanList.dispatchEvent(new Event('change'));
|
||||
|
||||
const lastIndex = otherClanList.selectedIndex;
|
||||
otherClanList.appendChild(opt);
|
||||
otherClanList.selectedIndex = lastIndex;
|
||||
|
||||
addClanModalBS.hide();
|
||||
clanName.value = "";
|
||||
clanTag.value = "";
|
||||
|
||||
@@ -26,19 +26,16 @@
|
||||
const deleteClanModalBS = new bootstrap.Modal('#deleteClanModal');
|
||||
if (deleteClanModal) {
|
||||
deleteClanModal.addEventListener('show.bs.modal', event => {
|
||||
const button = event.relatedTarget;
|
||||
const clanListId = button.getAttribute('data-bs-list');
|
||||
const clanList = document.querySelector(clanListId);
|
||||
const selectedClan = clanList.options[clanList.selectedIndex].text;
|
||||
const [clanList, otherClanList] = getClanLists(event);
|
||||
|
||||
const selectedClan = clanList.options[clanList.selectedIndex].text;
|
||||
const modalBodyInput = deleteClanModal.querySelector('#clan');
|
||||
modalBodyInput.innerText = selectedClan;
|
||||
|
||||
const submitButton = deleteClanModal.querySelector('button[name="submit"]');
|
||||
submitButton.addEventListener('click', function () {
|
||||
const button = event.relatedTarget;
|
||||
const clanListId = button.getAttribute('data-bs-list');
|
||||
const clanList = document.querySelector(clanListId);
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
submitButton.onclick = function () {}
|
||||
|
||||
const clanId = parseInt(clanList.value);
|
||||
|
||||
@@ -50,9 +47,19 @@
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
clanList.removeChild(clanList.children[clanList.selectedIndex]);
|
||||
const clanToRemove = clanList.children[clanList.selectedIndex];
|
||||
const clanIndex = clanToRemove.index;
|
||||
clanList.removeChild(clanToRemove);
|
||||
clanList.selectedIndex = 0;
|
||||
clanList.dispatchEvent(new Event('change'));
|
||||
|
||||
const lastOtherIndex = otherClanList.selectedIndex;
|
||||
otherClanList.children.item(clanIndex).remove();
|
||||
if (lastOtherIndex === clanIndex) {
|
||||
otherClanList.selectedIndex = 0;
|
||||
otherClanList.dispatchEvent(new Event('change'));
|
||||
}
|
||||
|
||||
deleteClanModalBS.hide();
|
||||
} else
|
||||
throw new Error(response.error)
|
||||
|
||||
@@ -37,10 +37,11 @@
|
||||
const editClanModalBS = new bootstrap.Modal('#editClanModal');
|
||||
if (editClanModal) {
|
||||
editClanModal.addEventListener('show.bs.modal', event => {
|
||||
const button = event.relatedTarget;
|
||||
const clanListId = button.getAttribute('data-bs-list');
|
||||
const clanList = document.querySelector(clanListId);
|
||||
const selectedClanItem = clanList.options[clanList.selectedIndex];
|
||||
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');
|
||||
@@ -66,7 +67,9 @@
|
||||
throw new Error(error);
|
||||
});
|
||||
|
||||
submitButton.addEventListener('click', function () {
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
submitButton.onclick = function () {}
|
||||
fetch("/clan/" + clanId, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({
|
||||
@@ -80,7 +83,10 @@
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
selectedClanItem.innerText = "[" + clanTag.value + "]" + " " + clanName.value;
|
||||
const newName = "[" + clanTag.value + "]" + " " + clanName.value;
|
||||
selectedClanItem.innerText = newName;
|
||||
otherSelClanItem.innerText = newName;
|
||||
|
||||
editClanModalBS.hide();
|
||||
clanName.value = "";
|
||||
clanTag.value = "";
|
||||
|
||||
Reference in New Issue
Block a user