Fix JS fetch credentials and CSV export from web UI

This commit is contained in:
2026-07-16 18:32:37 +07:00
parent 677f6028d9
commit 8e62eaf3f3
6 changed files with 41 additions and 9 deletions
+2 -1
View File
@@ -57,7 +57,7 @@ document.getElementById('login-form').addEventListener('submit', async (e) => {
form.append('username', document.getElementById('username').value);
form.append('password', document.getElementById('password').value);
try {
const res = await fetch('/api/auth/login', { method: 'POST', body: form });
const res = await fetch('/api/auth/login', { method: 'POST', body: form, credentials: 'include' });
if (res.ok) {
window.location.href = '/';
} else {
@@ -79,6 +79,7 @@ document.getElementById('register-form').addEventListener('submit', async (e) =>
const res = await fetch('/api/auth/register', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
credentials: 'include',
body: JSON.stringify({
username: document.getElementById('reg-username').value,
password: document.getElementById('reg-password').value,