How to use the admin-bro.ApiClient function in admin-bro

To help you get started, we’ve selected a few admin-bro 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 SoftwareBrothers / admin-bro-example-app / admin / components / some-stats.jsx View on Github external
import React, { useEffect, useState } from 'react'
import { WrapperBox, ApiClient, Placeholder, withNotice, StyledButton} from 'admin-bro'

const api = new ApiClient()

const NOTICE_MESSAGE = {
  message: 'I was clicked',
  type: 'success',
}

const SomeStats = ({ addNotice }) => {
  const [text, setText] = useState('')

  useEffect(() => {
    api.getPage({ pageName: 'customPage' }).then(res => {
      setText(res.data.text)
    })
  })

  return (
github SoftwareBrothers / admin-bro-example-app / admin / components / dashboard.jsx View on Github external
componentDidMount() {
    const api = new ApiClient()
    api.getDashboard({test: 1}).then((response) => {
      this.setState({ data: response.data })
    })
  }