| | |
| | | import { useInfiniteLoading } from '@12333/hooks'; |
| | | import { BaseData, useInfiniteLoading } from '@12333/hooks'; |
| | | import Taro from '@tarojs/taro'; |
| | | import * as enterpriseServices from '@12333/services/apiV2/enterprise'; |
| | | import { InfiniteData } from '@tanstack/vue-query'; |
| | | |
| | | type UseEnterpriseAddressesOptions = { |
| | | rows?: number; |
| | | onSuccess?: (data: InfiniteData<BaseData<API.GetEnterpriseAddressesQueryResultItem>>) => any; |
| | | }; |
| | | |
| | | export function useEnterpriseAddresses(options: UseEnterpriseAddressesOptions = {}) { |
| | | const { rows = 20 } = options; |
| | | const { rows = 20, onSuccess } = options; |
| | | |
| | | const { infiniteLoadingProps, invalidateQueries } = useInfiniteLoading( |
| | | ({ pageParam }) => { |
| | |
| | | }, |
| | | { |
| | | queryKey: ['enterpriseServices/getEnterpriseAddresses', rows], |
| | | onSuccess(data) { |
| | | onSuccess?.(data); |
| | | }, |
| | | } |
| | | ); |
| | | |