{"size": 707, "ext": "js", "max_stars_repo_path": "js/love-btn.js", "max_stars_repo_name": "Icesofty/JS-Click-Counter", "max_stars_repo_stars_event_min_datetime": "2021-06-04T13:05:10.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-04T13:05:10.000Z", "max_issues_repo_path": "js/love-btn.js", "max_issues_repo_name": "Icesofty/JS-Click-Counter", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/love-btn.js", "max_forks_repo_name": "Icesofty/JS-Click-Counter", "max_forks_repo_forks_event_min_datetime": "2021-06-04T13:45:53.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-04T13:45:53.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 20.2, "max_line_length": 75, "alphanum_fraction": 0.6237623762}
const loveBtn = document.getElementById("love-btn");
const loveCounter = document.getElementById("love-counter");

const firesbase = "https://love-send-js.firebaseio.com/onlinecounter.json";

let counter;

function get() {
  axios
    .get(firesbase)
    .then((response) => {
      counter = response.data.counter;
      updateCounter();
    })
    .catch((err) => console.log(err));
}

function updateCounter() {
  loveCounter.innerHTML = `${counter} visitors ❤️ this website`;
}

loveBtn.addEventListener("click", function (e) {
  axios
    .put(firesbase, {
      counter: counter + 1
    })
    .then(() => {
      get();
    })
    .catch((error) => console.log(error));
  console.log(e);
});

get();
