9daae13c68
* feat: delete defined resources * feat: api client * feat: view fields & tab field options & page info... * fix: view type
29 lines
792 B
TypeScript
29 lines
792 B
TypeScript
import React, { useState } from 'react';
|
|
// import { request } from 'umi';
|
|
import { TemplateLoader } from './TemplateLoader';
|
|
import { useRequest, request } from '@nocobase/client';
|
|
import templates from '@/templates';
|
|
import api from '@/api-client';
|
|
|
|
export function PageLoader(props: any) {
|
|
const { path } = props.match.params;
|
|
const { data = {}, error, loading, run } = useRequest(() => api.resource('pages').getRoutes());
|
|
const [first, setFirst] = useState(true);
|
|
(window as any).routesReload = async () => {
|
|
setFirst(false);
|
|
await run();
|
|
};
|
|
console.log(data);
|
|
return (
|
|
<TemplateLoader
|
|
{...props}
|
|
templates={templates}
|
|
loading={loading && first}
|
|
pages={data.data||{}}
|
|
pathname={`/${path}`}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export default PageLoader;
|