Release v2.1: GDPR, passkeys, session management, admin redesign
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const banner = document.getElementById("cookieBanner");
|
||||
const acceptBtn = document.getElementById("cookieAcceptBtn");
|
||||
const rejectBtn = document.getElementById("cookieRejectBtn");
|
||||
if (!banner) return;
|
||||
|
||||
const consent = localStorage.getItem("photohost_cookie_consent");
|
||||
if (!consent) {
|
||||
banner.hidden = false;
|
||||
}
|
||||
|
||||
async function saveConsent(analytics) {
|
||||
await fetch("/legal/cookie-consent", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ essential: true, analytics }),
|
||||
});
|
||||
localStorage.setItem("photohost_cookie_consent", analytics ? "all" : "essential");
|
||||
banner.hidden = true;
|
||||
}
|
||||
|
||||
acceptBtn?.addEventListener("click", () => saveConsent(true));
|
||||
rejectBtn?.addEventListener("click", () => saveConsent(false));
|
||||
});
|
||||
Reference in New Issue
Block a user