MCPcopy
hub / github.com/baidu/amis / handleApi

Method handleApi

packages/amis/src/renderers/Form/InputFile.tsx:653–671  ·  view source on GitHub ↗
(api: SchemaApi, payload?: object)

Source from the content-addressed store, hash-verified

651 }
652
653 handleApi(api: SchemaApi, payload?: object) {
654 const {data, env} = this.props;
655 if (api) {
656 const ctx = createObject(data, {
657 ...payload
658 });
659
660 const apiObject = normalizeApi(api);
661
662 if (apiObject.method?.toLowerCase() === 'get' && !apiObject.data) {
663 window.open(buildApi(apiObject, ctx).url);
664 } else {
665 apiObject.responseType = apiObject.responseType ?? 'blob';
666 env.fetcher(apiObject, ctx, {
667 responseType: 'blob'
668 });
669 }
670 }
671 }
672
673 handleSelect() {
674 const {disabled, multiple, maxLength, static: isStatic} = this.props;

Callers 2

handleClickFileMethod · 0.95
downloadTplMethod · 0.95

Calls 4

createObjectFunction · 0.90
normalizeApiFunction · 0.90
buildApiFunction · 0.90
openMethod · 0.45

Tested by

no test coverage detected