Optimize all modals (fetching). Implement add-player modal.
This commit is contained in:
@@ -69,4 +69,24 @@ function getSelectedClan(event) {
|
||||
const clanList = document.querySelector(clanListId);
|
||||
|
||||
return clanList.options[clanList.selectedIndex];
|
||||
}
|
||||
}
|
||||
|
||||
function loadClans() {
|
||||
const homeClanList = document.getElementById('home-clan');
|
||||
const oppClanList = document.getElementById('opponent-clan');
|
||||
|
||||
fetch('/clans_html')
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.text();
|
||||
})
|
||||
.then(data => {
|
||||
homeClanList.innerHTML = data;
|
||||
oppClanList.innerHTML = data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There has been a problem with your fetch operation:', error);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user