updated sse supporting react-openapi
This commit is contained in:
15
src/main.jsx
15
src/main.jsx
@@ -15,8 +15,7 @@ import Dashboard from './Dashboard';
|
||||
import FetchRequests from './FetchRequests';
|
||||
import FetchRequestDetail from './FetchRequestDetail';
|
||||
import ReportSnapshots from './ReportSnapshots';
|
||||
import { Admin, AppProvider, defaultFieldComponents } from '../react-openapi';
|
||||
import { configuration, profileConfiguration } from './openapi-config';
|
||||
import { AppProvider, Admin } from '../react-openapi';
|
||||
import { Buffer } from 'buffer';
|
||||
import process from 'process';
|
||||
import { AuthProvider } from "../react-auth";
|
||||
@@ -31,6 +30,14 @@ const rootElement = document.getElementById('root');
|
||||
const root = createRoot(rootElement);
|
||||
|
||||
const AUTH_BASE = import.meta.env.VITE_AUTH_BASE_URL;
|
||||
const API_BASE = import.meta.env.VITE_API_BASE_URL;
|
||||
|
||||
const specConfig = {
|
||||
specUrl: `${API_BASE}/openapi.yaml`,
|
||||
baseApiUrl: API_BASE,
|
||||
title: 'Khata Admin',
|
||||
getToken: () => localStorage.getItem('token'),
|
||||
};
|
||||
|
||||
const routerMapping = [
|
||||
{ path: "/", component: Home, headerTitle: "Home" },
|
||||
@@ -43,7 +50,7 @@ const routerMapping = [
|
||||
];
|
||||
|
||||
root.render(
|
||||
<AppProvider resourceOverrides={configuration} profileConfig={profileConfiguration}>
|
||||
<AppProvider specConfiguration={specConfig}>
|
||||
<BrowserRouter>
|
||||
<AuthProvider authBaseUrl={AUTH_BASE}>
|
||||
<AppTheme>
|
||||
@@ -60,7 +67,7 @@ root.render(
|
||||
path={path}
|
||||
element={
|
||||
path.startsWith("/admin") ? (
|
||||
<Component basePath="/admin" fieldComponents={{ ...defaultFieldComponents }} />
|
||||
<Component basePath="/admin" />
|
||||
) : (
|
||||
<Component />
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user