feat: add frontend dashboard, login page and portal entry
Public directory contains the Kanban SPA with dashboard UI, login page, and styles. Portal directory provides a standalone service entry page with CSS styling.
This commit is contained in:
18
public/login.js
Normal file
18
public/login.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const form = document.getElementById('loginForm');
|
||||
const tokenInput = document.getElementById('tokenInput');
|
||||
const loginError = document.getElementById('loginError');
|
||||
|
||||
form.addEventListener('submit', async (event) => {
|
||||
event.preventDefault();
|
||||
loginError.textContent = '';
|
||||
const response = await fetch('/api/auth/login', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: JSON.stringify({ token: tokenInput.value })
|
||||
});
|
||||
if (response.ok) {
|
||||
window.location.href = '/';
|
||||
return;
|
||||
}
|
||||
loginError.textContent = response.status === 429 ? '尝试次数过多' : 'Token 无效';
|
||||
});
|
||||
Reference in New Issue
Block a user