8base App Provider
Universal 8base App Provider loads fragments schema and provides Apollo client with it, authentication and table schema.
API
Table of Contents
EightBaseAppProvider
EightBaseAppProvider
universal provider which loads fragments schema and provides Apollo client with it, authentication and table schema.
Properties
uri
string? The 8base API field schema.authClient
Object? The 8base auth client.onRequestSuccess
Function? The callback which called when request is success.onRequestError
Function? The callback which called when request is fail.children
Function? The render function.
Usage
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { EightBaseAppProvider } from '@8base/app-provider';
import { Auth0WebClient } from '@8base/auth';
import { EightBaseBoostProvider, Loader } from '@8base/boost';
import { Routes } from './routes';
const auth0WebClient = new Auth0WebClient({
domain: AUTH_DOMAIN,
clientID: AUTH_CLIENT_ID,
redirectUri: `${window.location.origin}/auth/callback`,
workspaceId: 'workspace-id',
});
const Application = () => (
<BrowserRouter>
<EightBaseBoostProvider>
<EightBaseAppProvider uri={ process.env.REACT_APP_8BASE_API_URL } authClient={ auth0WebClient }>
{
({ loading }) => loading ? <Loader /> : <Routes />
}
</EightBaseAppProvider>
</EightBaseBoostProvider>
</BrowserRouter>
);
export { Application };