Add common.go_to_root for use as a callback function.

This commit is contained in:
voussoir 2022-09-27 17:53:54 -07:00
parent 19d12c3132
commit 353b9eadaf
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
3 changed files with 8 additions and 2 deletions

View file

@ -34,6 +34,12 @@ function is_wide_mode()
return getComputedStyle(document.documentElement).getPropertyValue("--wide").trim() === "1";
}
common.go_to_root =
function go_to_root()
{
window.location.href = "/";
}
common.refresh =
function refresh()
{

View file

@ -5,7 +5,7 @@
<a class="header_element" href="/tags">Tags</a>
{% if session.user %}
<a class="header_element dynamic_user_display_name" href="/userid/{{session.user.id}}">{{session.user.display_name}}</a>
<button id="logout_button" class="header_element" onclick="return api.users.logout(common.refresh);" style="flex:0">Logout</button>
<button id="logout_button" class="header_element" onclick="return api.users.logout(common.go_to_root);" style="flex:0">Logout</button>
{% else %}
<a class="header_element" href="/login">Log in</a>
{% endif %}

View file

@ -141,7 +141,7 @@ function login_register_callback(response)
}
else
{
window.location.href = "/";
common.go_to_root();
}
}
</script>