| | |
| | | import { useQuery } from '@tanstack/vue-query'; |
| | | import * as userServices from '@12333/services/apiV2/user'; |
| | | import { MaybeRef, unref } from 'vue'; |
| | | import { EnumUserBankCardAccess } from '@12333/constants'; |
| | | |
| | | type UsePersonalUserTransactionOptions = { |
| | | id?: MaybeRef<string>; |
| | |
| | | detail, |
| | | }; |
| | | } |
| | | |
| | | type UsePersonalUserBankCardOptions = { |
| | | access?: EnumUserBankCardAccess; |
| | | }; |
| | | |
| | | export function usePersonalUserBankCard(options: UsePersonalUserBankCardOptions = {}) { |
| | | const { access } = options; |
| | | |
| | | const { |
| | | isLoading, |
| | | isError, |
| | | data: detail, |
| | | refetch, |
| | | } = useQuery({ |
| | | queryKey: ['userServices/getPersonalUserBankCard'], |
| | | queryFn: async () => { |
| | | return await userServices.getPersonalUserBankCard( |
| | | { access: access }, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | }, |
| | | placeholderData: () => ({} as API.GetPersonalUserBankCardQueryResult), |
| | | onSuccess(data) {}, |
| | | }); |
| | | |
| | | return { |
| | | detail, |
| | | }; |
| | | } |