Socialify

Folder ..

Viewing loginCheck.js
22 lines (22 loc) • 645.0 B

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
checkForLogin();
function checkForLogin() {
  if (localStorage.getItem("UID")) {
    if (
      window.location.pathname !== "/account" &&
      window.location.pathname !== "/"
    ) {
      window.location = `${window.location.origin}/account`;
    }
    if (document.getElementById("notifyMeButton")) {
      document.getElementById("notifyMeButton").innerHTML = "My Account";
      document.getElementById("logout-button").style.display = "block";
    }
  } else {
    if (
      window.location.pathname !== "/notify" &&
      window.location.pathname !== "/"
    ) {
      window.location = `${window.location.origin}/notify`;
    }
  }
}