feat: function for chart data request
This commit is contained in:
parent
7c7fd1bb5e
commit
ba5fb97d1e
@ -3,8 +3,9 @@ import * as components from '.';
|
||||
import * as common from '../common';
|
||||
import { SchemaComponentOptions } from '../core/SchemaComponentOptions';
|
||||
import { useFilterActionProps } from './filter/useFilterActionProps';
|
||||
import { requestChartData } from './g2plot/requestChartData';
|
||||
|
||||
export const AntdSchemaComponentProvider = (props) => {
|
||||
const { children } = props;
|
||||
return <SchemaComponentOptions scope={{ useFilterActionProps }} components={{ ...components, ...common } as any}>{children}</SchemaComponentOptions>;
|
||||
return <SchemaComponentOptions scope={{ requestChartData, useFilterActionProps }} components={{ ...components, ...common } as any}>{children}</SchemaComponentOptions>;
|
||||
};
|
||||
|
@ -0,0 +1,12 @@
|
||||
import { APIClient } from '../../../api-client';
|
||||
|
||||
export const requestChartData = (options) => {
|
||||
return async function (this: { api: APIClient }) {
|
||||
try {
|
||||
const response = await this.api.request(options);
|
||||
return response?.data?.data;
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user