do not re-send request if user is already on that page

This commit is contained in:
hippoz 2020-10-07 19:15:33 +03:00
parent 7ec4a9fe12
commit 5aca17af7a

View file

@ -1,12 +1,15 @@
let selected = 'button-home';
let selectedButtonId = 'button-home';
const changeSelected = (buttonId) => {
A(`#${selected}`).removeClass('button-selected');
A(`#${selectedButtonId}`).removeClass('button-selected');
A(`#${buttonId}`).addClass('button-selected');
selected = buttonId;
selectedButtonId = buttonId;
};
const onButtonClick = (buttonId) => {
if (selectedButtonId === buttonId) {
return;
}
changeSelected(buttonId);
switch (buttonId) {
case 'button-home': {