• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zooniverse / front-end-monorepo / 16529320833

25 Jul 2025 06:47PM UTC coverage: 77.447% (-0.4%) from 77.896%
16529320833

Pull #6958

github

web-flow
Merge 5e9568c9a into 1609d4670
Pull Request #6958: lib-react-components: Add FavoritesIconButton component and useUserCollections hook

11349 of 17140 branches covered (66.21%)

Branch coverage included in aggregate %.

63 of 137 new or added lines in 13 files covered. (45.99%)

17572 of 20203 relevant lines covered (86.98%)

397.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

36.07
/packages/lib-react-components/src/hooks/usePanoptesAuthToken.js
1
import auth from 'panoptes-client/lib/auth'
1✔
2
import { useState } from 'react'
132!
3

4
const isBrowser = typeof window !== 'undefined'
1✔
5

6
let defaultToken
7
/*
8
  See comments in https://github.com/zooniverse/front-end-monorepo/pull/6345
9
  Top-level await in modules has been supported in Node
10
  and in all browsers since 2021. However, ES modules are still
11
  not supported in the monorepo. An immediately-invoked async
12
  function is a workaround when top-level await is not supported.
13
  https://v8.dev/features/top-level-await
14
*/
15
(async function getDefaultToken() {
7✔
16
  defaultToken = null
1!
17
  if (isBrowser) {
1✔
18
    await auth.checkCurrent()
1✔
19
    defaultToken = await auth.checkBearerToken()
1✔
20
  }
21
})()
22

23
export default function usePanoptesAuthToken() {
NEW
24
  const [token, setToken] = useState(defaultToken)
×
25

NEW
26
  async function fetchPanoptesAuthToken() {
×
NEW
27
    await auth.checkCurrent()
×
NEW
28
    const newToken = await auth.checkBearerToken()
×
NEW
29
    if (newToken !== token) {
×
NEW
30
      setToken(newToken)
×
NEW
31
    }
×
NEW
32
  }
×
33

NEW
34
  fetchPanoptesAuthToken()
×
NEW
35
  return token
×
36
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc