mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-26 14:19:24 +00:00
Fix type errors
This commit is contained in:
parent
c22ec2037d
commit
1b14717257
9
frontend/package-lock.json
generated
9
frontend/package-lock.json
generated
@ -39,7 +39,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.40.0",
|
"@playwright/test": "^1.40.0",
|
||||||
"@types/node": "^24.2.0",
|
"@types/node": "^24.2.1",
|
||||||
"@types/react": "^19.1.4",
|
"@types/react": "^19.1.4",
|
||||||
"@types/react-dom": "^19.1.5",
|
"@types/react-dom": "^19.1.5",
|
||||||
"@vitejs/plugin-react": "^4.5.0",
|
"@vitejs/plugin-react": "^4.5.0",
|
||||||
@ -2386,10 +2386,11 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "24.2.0",
|
"version": "24.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.1.tgz",
|
||||||
"integrity": "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw==",
|
"integrity": "sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~7.10.0"
|
"undici-types": "~7.10.0"
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.40.0",
|
"@playwright/test": "^1.40.0",
|
||||||
"@types/node": "^24.2.0",
|
"@types/node": "^24.2.1",
|
||||||
"@types/react": "^19.1.4",
|
"@types/react": "^19.1.4",
|
||||||
"@types/react-dom": "^19.1.5",
|
"@types/react-dom": "^19.1.5",
|
||||||
"@vitejs/plugin-react": "^4.5.0",
|
"@vitejs/plugin-react": "^4.5.0",
|
||||||
|
@ -11,7 +11,7 @@ export interface CompressParameters {
|
|||||||
fileSizeUnit: 'KB' | 'MB';
|
fileSizeUnit: 'KB' | 'MB';
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildFormData = (file: File, parameters: CompressParameters): FormData => {
|
const buildFormData = (parameters: CompressParameters, file: File): FormData => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("fileInput", file);
|
formData.append("fileInput", file);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ function stripExt(name: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Signature must be (file, params) to match useToolApiCalls interface
|
// Signature must be (file, params) to match useToolApiCalls interface
|
||||||
const buildFormData = (file: File, parameters: OCRParameters): FormData => {
|
const buildFormData = (parameters: OCRParameters, file: File): FormData => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('fileInput', file);
|
formData.append('fileInput', file);
|
||||||
parameters.languages.forEach((lang) => formData.append('languages', lang));
|
parameters.languages.forEach((lang) => formData.append('languages', lang));
|
||||||
|
@ -5,7 +5,7 @@ import type { ProcessingProgress } from './useToolState';
|
|||||||
|
|
||||||
export interface ApiCallsConfig<TParams = void> {
|
export interface ApiCallsConfig<TParams = void> {
|
||||||
endpoint: string | ((params: TParams) => string);
|
endpoint: string | ((params: TParams) => string);
|
||||||
buildFormData: (file: File, params: TParams) => FormData;
|
buildFormData: (params: TParams, file: File) => FormData;
|
||||||
filePrefix: string;
|
filePrefix: string;
|
||||||
responseHandler?: ResponseHandler;
|
responseHandler?: ResponseHandler;
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ export const useToolApiCalls = <TParams = void>() => {
|
|||||||
onStatus(`Processing ${file.name} (${i + 1}/${total})`);
|
onStatus(`Processing ${file.name} (${i + 1}/${total})`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const formData = config.buildFormData(file, params);
|
const formData = config.buildFormData(params, file);
|
||||||
const endpoint = typeof config.endpoint === 'function' ? config.endpoint(params) : config.endpoint;
|
const endpoint = typeof config.endpoint === 'function' ? config.endpoint(params) : config.endpoint;
|
||||||
const response = await axios.post(endpoint, formData, {
|
const response = await axios.post(endpoint, formData, {
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
|
@ -170,7 +170,7 @@ export const useToolOperation = <TParams = void>(
|
|||||||
// Individual file processing - separate API call per file
|
// Individual file processing - separate API call per file
|
||||||
const apiCallsConfig: ApiCallsConfig<TParams> = {
|
const apiCallsConfig: ApiCallsConfig<TParams> = {
|
||||||
endpoint: config.endpoint,
|
endpoint: config.endpoint,
|
||||||
buildFormData: config.buildFormData as (file: File, params: TParams) => FormData,
|
buildFormData: config.buildFormData as (params: TParams, file: File) => FormData,
|
||||||
filePrefix: config.filePrefix,
|
filePrefix: config.filePrefix,
|
||||||
responseHandler: config.responseHandler
|
responseHandler: config.responseHandler
|
||||||
};
|
};
|
||||||
|
@ -36,7 +36,7 @@ const OCR = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ocrOperation.resetResults();
|
ocrOperation.resetResults();
|
||||||
onPreviewFile?.(null);
|
onPreviewFile?.(null);
|
||||||
}, [ocrParams.parameters, selectedFiles]);
|
}, [ocrParams.parameters]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedFiles.length > 0 && expandedStep === 'files') {
|
if (selectedFiles.length > 0 && expandedStep === 'files') {
|
||||||
|
@ -29,7 +29,7 @@ const Sanitize = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
sanitizeOperation.resetResults();
|
sanitizeOperation.resetResults();
|
||||||
onPreviewFile?.(null);
|
onPreviewFile?.(null);
|
||||||
}, [sanitizeParams.parameters, selectedFiles]);
|
}, [sanitizeParams.parameters]);
|
||||||
|
|
||||||
const handleSanitize = async () => {
|
const handleSanitize = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -28,7 +28,7 @@ const Split = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
splitOperation.resetResults();
|
splitOperation.resetResults();
|
||||||
onPreviewFile?.(null);
|
onPreviewFile?.(null);
|
||||||
}, [splitParams.parameters, selectedFiles]);
|
}, [splitParams.parameters]);
|
||||||
|
|
||||||
const handleSplit = async () => {
|
const handleSplit = async () => {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user