3.0.0-beta.0 • Published 2 years ago
@8base/react-app-provider v3.0.0-beta.0
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
uristring? The 8base API field schema.authClientObject? The 8base auth client.onRequestSuccessFunction? Callback which is executed when a request is successful.onRequestErrorFunction? Callback which is executed when a request fails.extendLinksFunction? Function to extend the standard array of links.childrenFunction? 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 };