do not re-send request if user is already on that page
This commit is contained in:
parent
7ec4a9fe12
commit
5aca17af7a
1 changed files with 6 additions and 3 deletions
|
@ -1,12 +1,15 @@
|
||||||
let selected = 'button-home';
|
let selectedButtonId = 'button-home';
|
||||||
|
|
||||||
const changeSelected = (buttonId) => {
|
const changeSelected = (buttonId) => {
|
||||||
A(`#${selected}`).removeClass('button-selected');
|
A(`#${selectedButtonId}`).removeClass('button-selected');
|
||||||
A(`#${buttonId}`).addClass('button-selected');
|
A(`#${buttonId}`).addClass('button-selected');
|
||||||
selected = buttonId;
|
selectedButtonId = buttonId;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onButtonClick = (buttonId) => {
|
const onButtonClick = (buttonId) => {
|
||||||
|
if (selectedButtonId === buttonId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
changeSelected(buttonId);
|
changeSelected(buttonId);
|
||||||
switch (buttonId) {
|
switch (buttonId) {
|
||||||
case 'button-home': {
|
case 'button-home': {
|
||||||
|
|
Loading…
Reference in a new issue