mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-01 01:05:06 +08:00
changing sign in out icon depending on the account state
This commit is contained in:
parent
ee1eb8c8aa
commit
dd0d1d8e95
2 changed files with 17 additions and 4 deletions
|
@ -274,8 +274,12 @@ const authListener = Auth.onAuthStateChanged(async function (user) {
|
|||
const hash = window.location.hash;
|
||||
console.log(`auth state changed, user ${user ? true : false}`);
|
||||
if (user) {
|
||||
$("#top .signInOut .icon").html(
|
||||
`<i class="fas fa-fw fa-sign-out-alt"></i>`
|
||||
);
|
||||
await loadUser(user);
|
||||
} else {
|
||||
$("#top .signInOut .icon").html(`<i class="fas fa-fw fa-sign-in-alt"></i>`);
|
||||
if (window.location.pathname == "/account") {
|
||||
window.history.replaceState("", "", "/login");
|
||||
}
|
||||
|
@ -643,8 +647,12 @@ $(".pageLogin .login .button.signInWithGoogle").on("click", () => {
|
|||
// signInWithGitHub();
|
||||
// });
|
||||
|
||||
$("#top .signOut").on("click", () => {
|
||||
signOut();
|
||||
$("#top .signInOut").on("click", () => {
|
||||
if (Auth.currentUser) {
|
||||
signOut();
|
||||
} else {
|
||||
navigate("/login");
|
||||
}
|
||||
});
|
||||
|
||||
$(".pageLogin .register input").keyup((e) => {
|
||||
|
|
|
@ -143,9 +143,14 @@
|
|||
<i class="fas fa-fw fa-bell"></i>
|
||||
</div>
|
||||
</a> -->
|
||||
<a class="textButton signOut" tabindex="2" onclick="this.blur();" data-link>
|
||||
<a
|
||||
class="textButton signInOut"
|
||||
tabindex="2"
|
||||
onclick="this.blur();"
|
||||
data-link
|
||||
>
|
||||
<div class="icon">
|
||||
<i class="fas fa-fw fa-sign-out-alt"></i>
|
||||
<i class="fas fa-fw fa-sign-in-alt"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue