import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_client__ from "@tachybase/client";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
import * as __WEBPACK_EXTERNAL_MODULE_axios_mock_adapter__ from "axios-mock-adapter";
const demo3_rslib_entry_apiClient = new __WEBPACK_EXTERNAL_MODULE__tachybase_client__.APIClient();
const mock = new __WEBPACK_EXTERNAL_MODULE_axios_mock_adapter__["default"](demo3_rslib_entry_apiClient.axios);
const sleep = (value)=>new Promise((resolve)=>setTimeout(resolve, value));
mock.onGet('/users:list').reply(async ()=>{
    await sleep(1000);
    return [
        200,
        {
            data: [
                {
                    id: 1,
                    name: (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)()
                },
                {
                    id: 2,
                    name: (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)()
                }
            ]
        }
    ];
});
const ComponentA = ()=>{
    console.log('ComponentA');
    const { data, loading } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_client__.useRequest)({
        url: 'users:list',
        method: 'get'
    }, {
        uid: 'test'
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Table, {
        pagination: false,
        rowKey: 'id',
        loading: loading,
        dataSource: null == data ? void 0 : data.data,
        columns: [
            {
                title: 'Name',
                dataIndex: 'name'
            }
        ]
    });
};
const ComponentB = ()=>{
    console.log('ComponentB');
    const apiClient = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_client__.useAPIClient)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_antd__.Space, {
        children: [
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Input, {}),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                onClick: ()=>{
                    var _apiClient_service;
                    return null === (_apiClient_service = apiClient.service('test')) || void 0 === _apiClient_service ? void 0 : _apiClient_service.run();
                },
                children: "提交"
            })
        ]
    });
};
const demo3_rslib_entry_ = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.APIClientProvider, {
        apiClient: demo3_rslib_entry_apiClient,
        children: [
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(ComponentB, {}),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("br", {}),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("br", {}),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(ComponentA, {})
        ]
    });
export { demo3_rslib_entry_ as default };
