mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: add analytics init, identify, search tracking, consent header, settings toggle
This commit is contained in:
@@ -60,6 +60,16 @@ export function formatHeaders(init?: HeadersInit): Headers {
|
||||
if (token) {
|
||||
headers.set("Authorization", `Bearer ${token}`);
|
||||
}
|
||||
if (!token) {
|
||||
try {
|
||||
const consent = localStorage.getItem("ashim-analytics-consent");
|
||||
if (consent === "true" || consent === "false") {
|
||||
headers.set("X-Analytics-Consent", consent);
|
||||
}
|
||||
} catch {
|
||||
// localStorage unavailable
|
||||
}
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user