Skip to content

Commit

Permalink
fix: Correct usage of fetchQueryAndGetFromState
Browse files Browse the repository at this point in the history
  • Loading branch information
Crash-- committed Apr 13, 2023
1 parent 646b34c commit b939e41
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/pushClient/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ export const DESKTOP_BANNER = 'desktop_banner'
export const NOVIEWER_DESKTOP_CTA = 'noviewer_desktop_cta'

export const isClientAlreadyInstalled = async client => {
const { data } = await client.fetchQueryAndGetFromState(
Q('io.cozy.settings').getById('clients'),
{
const query = {
definition: Q('io.cozy.settings').getById('clients'),
options: {
as: 'io.cozy.settings/clients',
fetchPolicy: CozyClient.fetchPolicies.olderThan(30 * 1000)
}
)
}
const { data } = await client.fetchQueryAndGetFromState(query)
return Object.values(data).some(
device => get(device, 'attributes.software_id') === DESKTOP_SOFTWARE_ID
)
Expand Down

0 comments on commit b939e41

Please sign in to comment.