| | |
| | | id: MaybeRef<string>; |
| | | scene?: EnumGetStandardOrdersQueryScene; |
| | | onSuccess?: (data: API.GetStandardOrderQueryResult) => any; |
| | | refetchInterval?: MaybeRef<number | false>; |
| | | }; |
| | | |
| | | export function useStandardOrder({ id, scene, onSuccess }: UseStandardOrderOptions) { |
| | | export function useStandardOrder({ |
| | | id, |
| | | scene, |
| | | onSuccess, |
| | | refetchInterval = false, |
| | | }: UseStandardOrderOptions) { |
| | | const { |
| | | isLoading, |
| | | isError, |
| | | data: detail, |
| | | refetch, |
| | | } = useQuery({ |
| | | queryKey: ['standardOrderServices/getStandardOrder', id], |
| | | queryKey: ['standardOrderServices/getStandardOrder', id, scene], |
| | | queryFn: async () => { |
| | | const params: API.APIgetStandardOrderParams = { |
| | | id: unref(id), |
| | |
| | | onSuccess(data) { |
| | | onSuccess?.(data); |
| | | }, |
| | | refetchInterval: unref(refetchInterval), |
| | | }); |
| | | |
| | | return { detail, isLoading, isError, refetch }; |