summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/utils/notification-click.ts
blob: 316b278206241070b80587e0c575dc0219f84ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
let nav: ((href: string) => void) | undefined

export const setNavigate = (fn: (href: string) => void) => {
  nav = fn
}

export const handleNotificationClick = (href?: string) => {
  window.focus()
  if (!href) return
  if (nav) return nav(href)
  console.warn("notification-click: navigate function not set, falling back to window.location.assign")
  window.location.assign(href)
}