How to use the cozy-client.queryConnect function in cozy-client

To help you get started, we’ve selected a few cozy-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cozy / cozy.github.io / en / cozy-banks / src / ducks / reimbursements / Reimbursements.jsx View on Github external
)
  }
}

function mapStateToProps(state) {
  return {
    groupedExpenses: getGroupedFilteredExpenses(state),
    currentPeriod: getPeriod(state),
    filteringDoc: getFilteringDoc(state)
  }
}

const Reimbursements = compose(
  translate(),
  queryConnect({
    transactions: transactionsConn
  }),
  connect(mapStateToProps),
  withFilters,
  // We need to have a different query name otherwise we end with an infinite
  // loading
  withBrands({ queryName: 'reimbursementsPageTriggers' })
)(DumbReimbursements)

export default Reimbursements
github cozy / cozy.github.io / en / cozy-banks / src / ducks / settings / AccountsSettings.jsx View on Github external
)
  }
}

// TODO reactivate when we understand how sharings work
// const fetchAccountsSharingInfo = props => {
//   return Promise.resolve([])
// const { accounts } = props
// with cozy-client
// return Promise.all(accounts.data.map(account => {
//   return props.dispatch(fetchSharingInfo(ACCOUNT_DOCTYPE, account._id))
// }))
// }

export default compose(
  queryConnect({
    accountsCollection: accountsConn,
    apps: { query: () => Q(APP_DOCTYPE), as: 'apps' }
  }),
  translate()
)(AccountsSettings)
github cozy / cozy.github.io / en / cozy-banks / src / ducks / transactions / TransactionPageErrors / TransactionPageErrors.jsx View on Github external
// Use static property to be able to override
TransactionPageErrors.errorTypeToComponent = {
  'errored-trigger': TriggerErrorCard
}

TransactionPageErrors.propTypes = {
  triggerCol: PropTypes.object.isRequired,
  accounts: PropTypes.array.isRequired
}

export default compose(
  connect(state => ({
    accounts: getFilteredAccounts(state)
  })),
  queryConnect({
    triggerCol: {
      ...triggersConn,
      fetchPolicy: CozyClient.fetchPolicies.noFetch
    }
  }),
  React.memo
)(TransactionPageErrors)
github cozy / cozy.github.io / en / cozy-banks / src / ducks / transactions / TransactionsPage.jsx View on Github external
}

export const DumbTransactionsPage = TransactionsPage
export const UnpluggedTransactionsPage = compose(
  withRouter,
  translate(),
  withBreakpoints()
)(TransactionsPage)

UnpluggedTransactionsPage.propTypes = {
  filteredTransactions: PropTypes.array.isRequired
}

const ConnectedTransactionsPage = compose(
  withRouter,
  queryConnect({
    accounts: accountsConn,
    groups: groupsConn,
    triggers: triggersConn,
    transactions: transactionsConn
  }),
  connect(mapStateToProps)
)(UnpluggedTransactionsPage)

export const TransactionsPageWithBackButton = props => (
  
)

export default ConnectedTransactionsPage
github cozy / cozy.github.io / en / cozy-banks / src / components / KonnectorUpdateInfo / index.jsx View on Github external
isImportant
      />
    
  )
}

const outdatedKonnectors = {
  query: () =>
    Q(KONNECTOR_DOCTYPE).where({ available_version: { $exists: true } }),
  fetchPolicy: CozyClient.fetchPolicies.olderThan(30 * 1000),
  as: 'outdatedKonnectors'
}

export default compose(
  withClient,
  queryConnect({
    outdatedKonnectors
  }),
  withBreakpoints(),
  React.memo
)(KonnectorUpdateInfo)
github cozy / cozy.github.io / en / cozy-banks / src / ducks / balance / BalanceHeader.jsx View on Github external
accounts={accounts}
            transactions={transactions}
          />
        
      )}
      
    
  )
}

export const DumbBalanceHeader = BalanceHeader

export default compose(
  withBreakpoints(),
  memo,
  queryConnect({
    transactions: transactionsConn
  })
)(BalanceHeader)
github cozy / cozy.github.io / en / cozy-banks / src / ducks / settings / GroupsSettings.jsx View on Github external
<p>
            <button>}
              label={t('Groups.create')}
              theme="text"
              onClick={() =&gt; router.push('/settings/groups/new')}
            /&gt;
          <p></p>
        
      )
    }
  }
)

export default compose(
  queryConnect({
    groups: groupsConn,
    accounts: accountsConn
  }),
  translate()
)(Groups)
</button></p>
github cozy / cozy.github.io / en / cozy-banks / src / ducks / categories / CategoriesPage.jsx View on Github external
})

const mapStateToProps = (state, ownProps) => {
  return {
    categories: getCategoriesData(state, ownProps),
    filteringDoc: getFilteringDoc(state),
    filteredTransactionsByAccount: getTransactionsFilteredByAccount(state)
  }
}

export default compose(
  withRouter,
  withBreakpoints(),
  translate(),
  withClient,
  queryConnect({
    accounts: accountsConn,
    transactions: transactionsConn,
    settings: settingsConn,
    groups: groupsConn
  }),
  connect(
    mapStateToProps,
    mapDispatchToProps
  )
)(CategoriesPage)
github cozy / cozy.github.io / en / cozy-banks / src / ducks / settings / Configuration.jsx View on Github external
onToggle={onToggleFlag('amount_blur')}
              enabled={Boolean(flag('amount_blur'))}
              name="amountBlur"
            /&gt;
          
        

        {Configuration.renderExtraItems()}
      
    )
  }
}

export default compose(
  withClient,
  queryConnect({
    settingsCollection: settingsConn
  }),
  withAccountOrGroupLabeller('getAccountOrGroupLabel'),
  flag.connect,
  translate()
)(Configuration)
github cozy / cozy.github.io / en / cozy-banks / src / ducks / balance / AccountRow.jsx View on Github external
onChange={onSwitchChange}
            /&gt;
          
        
        {showUpdatedAtOutside &amp;&amp; (
          <div>
            
          </div>
        )}
      
    )
  }
}

export default compose(
  queryConnect({
    triggersCol: {
      ...triggersConn,
      fetchPolicy: CozyClient.fetchPolicies.noFetch
    }
  }),
  connect((state, { account }) =&gt; {
    const warningLimits = getWarningLimitPerAccount(state)
    const accountLimit = warningLimits[account._id]
    return {
      hasWarning: accountLimit ? accountLimit &gt; account.balance : false
    }
  }),
  withBreakpoints(),
  translate(),
  React.memo,
  withClient