import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { useGetGoalShopInfo, useRequest } from "../../hooks.js";
import { useCallback, useState } from "react";
//#region src/components/ecocup/customerList/hooks/useCustomerApi.ts
const useCustomerListsApi = () => {
	const [loading, setLoading] = useState(false);
	const [data, setData] = useState({});
	const { get } = useRequest();
	const { goalShopId } = useGetGoalShopInfo();
	return {
		loading,
		data,
		run: useCallback(function() {
			var _ref = _asyncToGenerator(function* (params) {
				try {
					setLoading(true);
					const res = yield get("/shop/wallet/eco/customer", _objectSpread2({
						with_cup_count_flag: 1,
						goal_shop_id: goalShopId
					}, params));
					setData((res === null || res === void 0 ? void 0 : res.data) || {});
					setLoading(false);
				} catch (error) {
					setLoading(false);
				}
			});
			return function(_x) {
				return _ref.apply(this, arguments);
			};
		}(), [])
	};
};
//#endregion
export { useCustomerListsApi };
