Skip to content

Commit

Permalink
fix: Use a query for fetchAllKonnectors()
Browse files Browse the repository at this point in the history
  • Loading branch information
Ldoppea committed Sep 24, 2024
1 parent d4a2575 commit 95cc6d3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/components/Sections/queries/konnectors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import memoize from 'lodash/memoize'

import CozyClient from 'cozy-client'
import CozyClient, { Q } from 'cozy-client'

import { IOCozyKonnector } from 'cozy-client/types/types'
import { KonnectorFromRegistry } from 'components/Sections/SectionsTypes'
Expand Down Expand Up @@ -36,10 +36,8 @@ export const fetchAllKonnectors = async (
client: CozyClient,
channel = 'stable'
): Promise<{ [key: string]: IOCozyKonnector[] }> => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
const { data } = (await client.stackClient.fetchJSON(
'GET',
`/registry?versionsChannel=${channel}&filter[type]=konnector&limit=300`
const { data } = (await client.query(
Q('io.cozy.apps_registry').getById(`konnectors/${channel}`)
)) as { data: KonnectorFromRegistry[] }

return memoizedGroupByCategory(data)
Expand Down

0 comments on commit 95cc6d3

Please sign in to comment.