1 import { useCallback } from 'react';
3 import { queryShareMap } from '@proton/shared/lib/api/drive/link';
4 import type { ShareMapPayload } from '@proton/shared/lib/interfaces/drive/link';
6 import { useDebouncedRequest } from '../../_api';
8 interface ShareMapParams {
15 export type FetchShareMap = (params: ShareMapParams, signal?: AbortSignal) => Promise<ShareMapPayload>;
17 export default function useFetchShareMap() {
18 const debouncedRequest = useDebouncedRequest();
20 return useCallback<FetchShareMap>(({ shareId, lastIndex, sessionName, pageSize }, signal) => {
21 return debouncedRequest<ShareMapPayload>(queryShareMap(shareId, lastIndex, sessionName, pageSize), signal);