Split app.js in to smaller chunks

This commit is contained in:
2025-01-30 18:18:29 +01:00
parent e74871bf94
commit 4a9139e4d8
7 changed files with 264 additions and 8 deletions

25
public/js/auth.js Normal file
View File

@@ -0,0 +1,25 @@
export function checkSession() {
return fetch('/check-session')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
});
}
export function login(username, password) {
return fetch('/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic ' + btoa(username + ':' + password)
}
});
}
export function logout() {
return fetch('/logout', {
method: 'POST'
});
}