// Check if user is already authenticated via Cloudflare Access
async function checkAuth() {
try {
const response = await fetch('/dashboard/', {
method: 'HEAD',
redirect: 'manual'
});
// If we can access dashboard, user is already logged in
if (response.type !== 'opaqueredirect') {
window.location.href = '/dashboard/';
}
} catch (error) {
console.log('Not authenticated');
}
}
// Check auth on page load
checkAuth();