| | |
| | | type UseEnterpriseAddressesOptions = { |
| | | rows?: number; |
| | | onSuccess?: (data: InfiniteData<BaseData<API.GetEnterpriseAddressesQueryResultItem>>) => any; |
| | | refeshDidShow?: boolean; |
| | | }; |
| | | |
| | | export function useEnterpriseAddresses(options: UseEnterpriseAddressesOptions = {}) { |
| | | const { rows = 20, onSuccess } = options; |
| | | const { rows = 20, onSuccess, refeshDidShow = true } = options; |
| | | |
| | | const { infiniteLoadingProps, invalidateQueries } = useInfiniteLoading( |
| | | ({ pageParam }) => { |
| | |
| | | onSuccess(data) { |
| | | onSuccess?.(data); |
| | | }, |
| | | refeshDidShow, |
| | | } |
| | | ); |
| | | |
| | |
| | | |
| | | const { infiniteLoadingProps } = useEnterpriseAddresses({ |
| | | rows: 100, |
| | | refeshDidShow: false, |
| | | onSuccess(res) { |
| | | const data = res.pages[0].data; |
| | | const address = data.find((item) => item.isDefault); |