wupengfei
2025-09-23 0d4707520940affeb4ac1697bbce9cebf5da60f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { useQuery } from '@tanstack/vue-query';
import * as userServices from '@12333/services/apiV2/user';
import { MaybeRef, unref } from 'vue';
 
type UsePersonalUserTransactionOptions = {
  id?: MaybeRef<string>;
};
 
export function useGetPersonalUserTransaction(options: UsePersonalUserTransactionOptions = {}) {
  const { id } = options;
 
  const {
    isLoading,
    isError,
    data: detail,
    refetch,
  } = useQuery({
    queryKey: ['userServices/getPersonalUserTransaction', id],
    queryFn: async () => {
      return await userServices.getPersonalUserTransaction(
        { id: unref(id) },
        {
          showLoading: false,
        }
      );
    },
    placeholderData: () => ({} as API.GetPersonalUserTransactionQueryResult),
    enabled: computed(() => !!unref(id)),
  });
 
  return {
    detail,
  };
}