(code: string)
| 95 | * Update click count for a local short URL |
| 96 | */ |
| 97 | export function incrementLocalClickCount(code: string): void { |
| 98 | if (typeof window === "undefined") return; |
| 99 | try { |
| 100 | const urls = getLocalShortUrls(); |
| 101 | const url = urls.find((u) => u.code === code); |
| 102 | if (url) { |
| 103 | url.clicks = (url.clicks || 0) + 1; |
| 104 | url.lastClickAt = new Date().toISOString(); |
| 105 | localStorage.setItem(LOCAL_URLS_KEY, JSON.stringify(urls)); |
| 106 | } |
| 107 | } catch (error) { |
| 108 | console.error("Error updating click count:", error); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | // ============================================================================ |
| 113 | // Local Storage - Click Events |
no test coverage detected