Skip to content

Commit 401d371

Browse files
committed
refactor(app/hooks): simplify useAckee
1 parent da72b99 commit 401d371

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

src/app/hooks.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
import * as tracker from 'ackee-tracker'
22
import { useEffect } from 'react'
33

4-
import { useSingleton } from '@/common/hooks'
5-
64
const DETAILED = true
75

86
export const useAckee = () => {
9-
const instance = useSingleton(() => tracker.create('https://ackee.exuanbo.xyz/'))
10-
117
useEffect(() => {
12-
const attributes = tracker.attributes(DETAILED)
13-
148
const { pathname, origin } = window.location
159
const url = new URL(pathname, origin)
1610

17-
const { stop } = instance.record('bc75fd47-884f-4723-aaf6-3384103e0095', {
18-
...attributes,
19-
siteLocation: url.href,
20-
})
11+
const { stop } = tracker
12+
.create('https://ackee.exuanbo.xyz/')
13+
.record('bc75fd47-884f-4723-aaf6-3384103e0095', {
14+
...tracker.attributes(DETAILED),
15+
siteLocation: url.href,
16+
})
2117
return stop
22-
}, [instance])
18+
}, [])
2319
}

0 commit comments

Comments
 (0)