apiclient
This commit is contained in:
@@ -2,6 +2,7 @@ import { useCallback, useRef, useState } from 'react';
|
||||
import type { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
||||
import useFileDrop from './useFileDrop';
|
||||
import { DEFAULT_FOLDER_NAME, hasFiles } from '../../app/appLayoutUtils';
|
||||
import { fetchDocument } from '../../lib/apiClient';
|
||||
|
||||
type Identifier = string | number;
|
||||
type FolderId = Identifier | 'root' | null;
|
||||
@@ -174,8 +175,7 @@ const useDocumentUploads = ({
|
||||
let conflictDocument = null;
|
||||
if (conflictId) {
|
||||
try {
|
||||
const { data } = await apiClient.get(`/documents/${conflictId}`);
|
||||
conflictDocument = (data as any)?.document ?? data ?? null;
|
||||
conflictDocument = await fetchDocument(conflictId);
|
||||
} catch (fetchError) {
|
||||
console.warn('[Uploads] failed to fetch conflict document', fetchError);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import useTags from './useTags';
|
||||
import useCorrespondents from './useCorrespondents';
|
||||
import useTenantManager from './useTenantManager';
|
||||
import useDocuments from './useDocuments';
|
||||
import { fetchDocument } from '../../lib/apiClient';
|
||||
import useFolderTree from './useFolderTree';
|
||||
import useFolderTreeActions from './useFolderTreeActions';
|
||||
import useDocumentTagging from './useDocumentTagging';
|
||||
@@ -238,7 +239,7 @@ const useDocumentsWorkspace = ({
|
||||
if (!documentId) {
|
||||
return null;
|
||||
}
|
||||
const { data } = await api.get(`/documents/${documentId}`);
|
||||
const data = await fetchDocument(documentId);
|
||||
return extractDocumentFromResponse(data);
|
||||
},
|
||||
[extractDocumentFromResponse],
|
||||
@@ -449,7 +450,6 @@ const useDocumentsWorkspace = ({
|
||||
routeDocumentId: previewDocumentId,
|
||||
documentsManager,
|
||||
selectedFolder,
|
||||
api,
|
||||
notifyApiError,
|
||||
navigate,
|
||||
locationPathname: location.pathname,
|
||||
|
||||
Reference in New Issue
Block a user