How to use the cozy-client.CozyProvider 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 / index.jsx View on Github external
const injectBarInDOM = data => {
  if (document.getElementById('coz-bar') !== null) {
    return
  }
  // import React related modules on init only
  const React = require('react')
  const { render } = require('react-dom')
  const { connect, Provider } = require('react-redux')
  const I18n = require('cozy-ui/react/I18n').default
  const Bar = require('components/Bar').default
  const CozyProvider = require('cozy-client').CozyProvider

  const { cozyClient } = data

  const barNode = createBarElement()
  const appNode = document.querySelector(APP_SELECTOR)
  if (!appNode) {
    // eslint-disable-next-line no-console
    console.warn(
      `Cozy-bar is looking for a "${APP_SELECTOR}" tag that contains your application and can't find it :'(… The BAR is now disabled`
    )
    return null
  }

  document.body.insertBefore(barNode, appNode)

  // method to put cozy-bar z-index on the top when Drawer visible and vice versa