app: use auth model for init, sidebar, login

This commit is contained in:
2026-08-15 02:08:16 +00:00
parent 64f3a77411
commit 4f74192302
3 changed files with 37 additions and 15 deletions
+3 -5
View File
@@ -11,9 +11,7 @@ import {
html,
apiFetch,
toast,
setAuthToken,
getAuthToken,
handleLoginSuccess,
doLogin,
webauthnSupported,
startAuthentication,
esc,
@@ -89,7 +87,7 @@ async function doPasswordLogin() {
});
if (res.ok) {
handleLoginSuccess(res.data);
doLogin(res.data);
toast('Welcome, ' + esc(username), 'success');
} else {
errEl.textContent = res.error || 'Login failed';
@@ -173,7 +171,7 @@ const passkeyClickHandler = async () => {
});
if (finishRes.ok) {
handleLoginSuccess(finishRes.data);
doLogin(finishRes.data);
toast('Welcome, ' + esc(username), 'success');
} else {
errEl.textContent = finishRes.error || 'Passkey authentication failed';