|
1 | | -import { |
2 | | - getShowEmployment, |
3 | | - MagicLinkParams, |
4 | | - postGenerateMagicLink, |
5 | | -} from '@/src/client'; |
| 1 | +import { useMutation } from '@tanstack/react-query'; |
| 2 | +import { MagicLinkParams, postGenerateMagicLink } from '@/src/client'; |
6 | 3 | import { useClient } from '@/src/context'; |
7 | | -import { ContractAmendmentParams } from '@/src/flows/ContractAmendment/types'; |
8 | 4 |
|
9 | 5 | import { Client } from '@/src/client/client'; |
10 | | -import { useMutation, useQuery } from '@tanstack/react-query'; |
11 | | - |
12 | | -type UseEmployment = Pick<ContractAmendmentParams, 'employmentId'>; |
13 | | - |
14 | | -/** |
15 | | - * Hook to retrieve employment details for a specific employment ID. |
16 | | - * |
17 | | - * @param {Object} params - The parameters for the query. |
18 | | - * @param {string} params.employmentId - The ID of the employment to fetch details for. |
19 | | - * @returns {UseQueryResult<any, unknown>} - The result of the query, including the employment details. |
20 | | - */ |
21 | | -export const useEmploymentQuery = ({ employmentId }: UseEmployment) => { |
22 | | - const { client } = useClient(); |
23 | | - return useQuery({ |
24 | | - queryKey: ['employment', employmentId], |
25 | | - retry: false, |
26 | | - queryFn: () => { |
27 | | - return getShowEmployment({ |
28 | | - client: client as Client, |
29 | | - headers: { |
30 | | - Authorization: ``, |
31 | | - }, |
32 | | - path: { employment_id: employmentId }, |
33 | | - }); |
34 | | - }, |
35 | | - enabled: !!employmentId, |
36 | | - select: ({ data }) => data?.data?.employment, |
37 | | - }); |
38 | | -}; |
39 | 6 |
|
40 | 7 | export const useMagicLink = () => { |
41 | 8 | const { client } = useClient(); |
|
0 commit comments