( id: string, user?: Pick<LoggedUser, 'id'>, )
| 312 | * carry an author-only field. |
| 313 | */ |
| 314 | export const picksViewCountQueryOptions = ( |
| 315 | id: string, |
| 316 | user?: Pick<LoggedUser, 'id'>, |
| 317 | ) => ({ |
| 318 | queryKey: generateQueryKey(RequestKey.Picks, user, id, 'viewCount'), |
| 319 | queryFn: async (): Promise<number | null> => { |
| 320 | const data = await gqlClient.request<{ |
| 321 | picks: { viewCount: number | null } | null; |
| 322 | }>(PICKS_VIEW_COUNT_QUERY, { id }); |
| 323 | return data.picks?.viewCount ?? null; |
| 324 | }, |
| 325 | staleTime: 0, |
| 326 | }); |
| 327 | |
| 328 | /** Counts the viewer once per list on the API; the author is never counted. */ |
| 329 | export const trackPicksView = async (id: string): Promise<void> => { |
no test coverage detected