This package has been deprecated

Author message:

This package was moved to @8base-react/app-provider package. Use it instead.

@8base/app-provider
TypeScript icon, indicating that this package has built-in type declarations

0.37.2 • Public • Published

8base App Provider

Universal 8base App Provider loads fragments schema and provides it to Apollo client, along with authentication and table schema.

API

Table of Contents

EightBaseAppProvider

EightBaseAppProvider universal provider which loads fragments schema and provides it to Apollo client, along with authentication and table schema.

Properties

  • uri string? The 8base API field schema.
  • authClient Object? The 8base auth client.
  • onRequestSuccess Function? Callback which is executed when a request is successful.
  • onRequestError Function? Callback which is executed when a request fails.
  • extendLinks Function? Function to extend the standard array of links.
  • children Function? The render function.

Usage

import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { EightBaseAppProvider } from '@8base/app-provider';
import { WebAuth0AuthClient } from '@8base/web-auth0-auth-client';
import { EightBaseBoostProvider, Loader } from '@8base/boost';

import { Routes } from './routes';

const authClient = new WebAuth0AuthClient({
  domain: AUTH_DOMAIN,
  clientId: AUTH_CLIENT_ID,
  redirectUri: `${window.location.origin}/auth/callback`,
  logoutRedirectUri: `${window.location.origin}/auth`,
  workspaceId: 'workspace-id',
});

const Application = () => (
  <BrowserRouter>
    <EightBaseBoostProvider>
      <EightBaseAppProvider uri={ process.env.REACT_APP_8BASE_API_URL } authClient={ authClient }>
        {
          ({ loading }) => loading ? <Loader /> : <Routes />
        }
      </EightBaseAppProvider>
    </EightBaseBoostProvider>
  </BrowserRouter>
);

export { Application };

Readme

Keywords

none

Package Sidebar

Install

npm i @8base/app-provider

Weekly Downloads

3

Version

0.37.2

License

MIT

Unpacked Size

29.2 kB

Total Files

28

Last publish

Collaborators

  • dav1nx1
  • jorge.osorio
  • 8base-bot