Move static pages into subfolders using index.html
This commit is contained in:
parent
7e651ace27
commit
96d8e08dbd
|
|
@ -5,8 +5,8 @@
|
|||
<title>NOTXCS</title>
|
||||
<script>
|
||||
fetch('/auth/me').then(r => r.json()).then(data => {
|
||||
window.location.replace(data.success ? '/dashboard.html' : '/login.html');
|
||||
}).catch(() => window.location.replace('/login.html'));
|
||||
window.location.replace(data.success ? '/dashboard' : '/login');
|
||||
}).catch(() => window.location.replace('/login'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ async function api(path, options = {}) {
|
|||
});
|
||||
const data = await res.json().catch(() => ({ success: false, message: 'Invalid response from server' }));
|
||||
if (res.status === 401) {
|
||||
window.location.href = '/login.html';
|
||||
window.location.href = '/login';
|
||||
throw new Error('Not authenticated');
|
||||
}
|
||||
return data;
|
||||
|
|
@ -18,7 +18,7 @@ async function api(path, options = {}) {
|
|||
async function init() {
|
||||
const me = await api('/auth/me');
|
||||
if (!me.success) {
|
||||
window.location.href = '/login.html';
|
||||
window.location.href = '/login';
|
||||
return;
|
||||
}
|
||||
document.getElementById('username-display').textContent = me.user.username;
|
||||
|
|
@ -188,7 +188,7 @@ document.getElementById('delete-place-btn').addEventListener('click', async () =
|
|||
|
||||
document.getElementById('logout-btn').addEventListener('click', async () => {
|
||||
await api('/auth/logout', { method: 'POST' });
|
||||
window.location.href = '/login.html';
|
||||
window.location.href = '/login';
|
||||
});
|
||||
|
||||
// --- ACL (allowed persons / credentials) management ---
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ document.getElementById('login-form').addEventListener('submit', async (e) => {
|
|||
return;
|
||||
}
|
||||
|
||||
window.location.href = '/dashboard.html';
|
||||
window.location.href = '/dashboard';
|
||||
} catch (err) {
|
||||
errorEl.textContent = 'Unable to reach the server. Please try again.';
|
||||
errorEl.classList.add('visible');
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ document.getElementById('register-form').addEventListener('submit', async (e) =>
|
|||
return;
|
||||
}
|
||||
|
||||
window.location.href = '/dashboard.html';
|
||||
window.location.href = '/dashboard';
|
||||
} catch (err) {
|
||||
errorEl.textContent = 'Unable to reach the server. Please try again.';
|
||||
errorEl.classList.add('visible');
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<button type="submit" class="primary">Log in</button>
|
||||
</form>
|
||||
<p class="switch-link">Don't have an account? <a href="/register.html">Register</a></p>
|
||||
<p class="switch-link">Don't have an account? <a href="/register">Register</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/login.js"></script>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<button type="submit" class="primary">Register</button>
|
||||
</form>
|
||||
<p class="switch-link">Already have an account? <a href="/login.html">Log in</a></p>
|
||||
<p class="switch-link">Already have an account? <a href="/login">Log in</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/register.js"></script>
|
||||
Loading…
Reference in a new issue