access: Minor JS improvements

This commit is contained in:
2025-01-05 14:41:11 +01:00
parent c69d9c11ec
commit a6072fa465
2 changed files with 11 additions and 23 deletions

View File

@ -1,5 +1,7 @@
"use strict";
window.ELWIG_API = window.ELWIG_API || null;
function getCredentialsUsername() {
return window.localStorage.getItem(`${CLIENT}/username`);
}
@ -11,7 +13,7 @@ function getCredentialsPassword() {
function getBasicAuth() {
return {
'Authorization': 'Basic ' + btoa(getCredentialsUsername() + ':' + getCredentialsPassword()),
}
};
}
async function _get(path) {
@ -311,10 +313,6 @@ window.addEventListener('hashchange', () => {
render();
});
window.addEventListener('pageshow', update)
document.addEventListener('visibilitychange', update);
function actionLogin(form) {
window.localStorage.setItem(`${CLIENT}/username`, form.username.value);
window.localStorage.setItem(`${CLIENT}/password`, form.password.value);