// ── Cookie auth bridge ─────────────────────────────────────────── // Called from Blazor via IJSRuntime after login/logout to sync the // middleware-level auth cookie with the Blazor auth state. window.heimdallAuth = { signIn: async function (data) { try { const response = await fetch('/_auth/signin', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data), credentials: 'include' }); return response.status; } catch { return 0; } }, signOut: async function () { try { const response = await fetch('/_auth/signout', { method: 'POST', credentials: 'include' }); return response.ok; } catch { return false; } } }; // -- File download helper -- function downloadFile(filename, mimeType, base64Data) { var bytes = Uint8Array.from(atob(base64Data), function(c) { return c.charCodeAt(0); }); var blob = new Blob([bytes], { type: mimeType }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }