fix: template list provider bug (#3950)

This commit is contained in:
jack zhang 2024-04-07 14:29:20 +08:00 committed by GitHub
parent e81cfcbe98
commit 89b73ba389
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -122,7 +122,7 @@ export const useSchemaTemplateManager = () => {
}; };
}; };
const Internal = (props) => { export const RemoteSchemaTemplateManagerProvider = (props) => {
const api = useAPIClient(); const api = useAPIClient();
const { render } = useAppSpin(); const { render } = useAppSpin();
const options = { const options = {
@ -153,19 +153,10 @@ const Internal = (props) => {
); );
}; };
export const RemoteSchemaTemplateManagerProvider: React.FC<{ children?: ReactNode }> = (props) => {
const location = useLocation();
if (location.pathname.startsWith('/admin')) {
return <Internal {...props} />;
}
return <>{props.children}</>;
};
export class RemoteSchemaTemplateManagerPlugin extends Plugin { export class RemoteSchemaTemplateManagerPlugin extends Plugin {
async load() { async load() {
this.addRoutes(); this.addRoutes();
this.addComponents(); this.addComponents();
this.app.use(RemoteSchemaTemplateManagerProvider);
} }
addComponents() { addComponents() {