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