pdf: fix route

Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
rodrigo committed 2026-02-27 19:02:18 -03:00
1 parent 61a1631519
commit f4afe83db0
9 files changed
+150 -127

No files matched your search

+16 -4
View File
@@ -2,6 +2,7 @@ import React, { useState, useCallback } from 'react';
import { useDropzone } from 'react-dropzone';
import axios from 'axios';
import { toast } from 'react-toastify';
import { useAuth } from '../../contexts/AuthContext';
import {
DocumentIcon,
CloudArrowUpIcon,
@@ -36,6 +37,7 @@ type OperationType =
| 'info';
export const PDFManipulationPage: React.FC = () => {
const { getToken } = useAuth();
const [selectedOperation, setSelectedOperation] = useState<OperationType>('compress');
const [files, setFiles] = useState<File[]>([]);
const [processing, setProcessing] = useState(false);
@@ -74,10 +76,6 @@ export const PDFManipulationPage: React.FC = () => {
setResult(null);
};
const getToken = () => {
return localStorage.getItem('token');
};
const processFiles = async () => {
if (files.length === 0) {
toast.error('Selecione pelo menos um arquivo');
@@ -645,6 +643,20 @@ export const PDFManipulationPage: React.FC = () => {
{op.tempoProcessamento}ms
</p>
)}
{op.status === 'CONCLUIDO' && op.arquivosResultado && op.arquivosResultado.length > 0 && (
<div className="mt-2 space-y-1">
{op.arquivosResultado.map((arquivo: string, index: number) => (
<button
key={index}
onClick={() => downloadFile(op.id, index)}
className="flex items-center space-x-1 w-full text-xs text-blue-600 hover:text-blue-700 hover:bg-blue-50 p-1 rounded"
>
<ArrowDownTrayIcon className="h-3 w-3" />
<span>Arquivo {index + 1}</span>
</button>
))}
</div>
)}
</div>
))}
</div>