Something went wrong. Try again.
Tangled notifications browser extension
Something went wrong. Try again.
123456789101112131415161718const BASE_URL = "https://tangled.org";
export const getNotificationsUrl = (): string => `${BASE_URL}/notifications`;
export const getNotificationsUrlPattern = (): string => `${BASE_URL}/notifications*`;
export const fetchNotificationCount = async (): Promise<number> => { const response = await fetch(`${BASE_URL}/notifications/count`, { credentials: "include", }); // FIX: requires backend to return 401 when not logged in (currently returns 200 even if not logged in) if (!response.ok) throw new Error(`HTTP ${response.status}`); const html = await response.text(); const match = html.match(/>\s*(\d+\+?)\s*</); return match ? parseInt(match[1], 10) : 0;};