wupengfei
9 小时以前 aebf1603cd6df5341160ffe23c715919bf14c4a7
packages/hooks/user.ts
@@ -1,5 +1,6 @@
import { MaybeRef, computed, unref } from 'vue';
import * as userResumeServices from '@12333/services/apiV2/userResume';
import * as enterpriseEmployeeServices from '@12333//services/apiV2/enterpriseEmployee';
import { useQuery, useQueryClient } from '@tanstack/vue-query';
type UseUserResumeOptions = {
@@ -52,3 +53,32 @@
    updateUserResume,
  };
}
type UseGetEnterpriseEmployeeOptions = {
  id?: MaybeRef<string>;
};
export function useGetEnterpriseEmployee(options: UseGetEnterpriseEmployeeOptions = {}) {
  const { id } = options;
  const { data, refetch, isLoading, isError } = useQuery({
    queryKey: ['enterpriseEmployeeServices/getEnterpriseEmployee', id],
    queryFn: async () => {
      return await enterpriseEmployeeServices.getEnterpriseEmployee(
        { id: unref(id) },
        {
          showLoading: false,
        }
      );
    },
    placeholderData: () => ({} as API.GetEnterpriseEmployeeQueryResult),
    enabled: computed(() => !!unref(id)),
  });
  return {
    enterpriseEmployeeInfo: data,
    refetch,
    isLoading,
    isError,
  };
}