How to use the cozy-client/dist.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-bar / src / components / Settings / index.jsx View on Github external
const mapStateToProps = state => ({
  storageData: getStorageData(state),
  settingsAppURL: getSettingsAppURL(state),
  isBusy: isSettingsBusy(state),
  isFetching: isFetchingSettings(state)
})

const mapDispatchToProps = dispatch => ({
  fetchSettingsData: () => dispatch(fetchSettingsData()),
  logOut: () => dispatch(logOut())
})
let exported
if (cozyClientCanCheckPremium()) {
  exported = compose(
    translate(),
    queryConnect({
      instanceQuery: instanceReq,
      contextQuery: contextReq,
      diskUsageQuery: diskUsageReq
    }),
    connect(
      mapStateToProps,
      mapDispatchToProps
    )
  )(Settings)
} else {
  exported = compose(
    translate(),
    connect(
      mapStateToProps,
      mapDispatchToProps
    )