app: use auth model for init, sidebar, login
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user