add logs
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ import createNextIntlPlugin from 'next-intl/plugin';
|
|||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
experimental: {
|
experimental: {
|
||||||
serverActions: {
|
serverActions: {
|
||||||
bodySizeLimit: '6mb',
|
bodySizeLimit: '50mb',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,14 +102,17 @@ export async function cancelUpload(udloadId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function chunkUpload(formData: FormData) {
|
export async function chunkUpload(formData: FormData) {
|
||||||
|
console.log('chunkUpload');
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/files/chunk`, {
|
const response = await fetch(`${API_BASE_URL}/api/v1/files/chunk`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
|
console.log('chunkUpload fetch');
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
let parsed = await response.json();
|
let parsed = await response.json();
|
||||||
|
console.log('chunkUpload response.ok');
|
||||||
|
console.log(parsed);
|
||||||
|
|
||||||
if (parsed.message_desc === 'Upload cancelled successfully') {
|
if (parsed.message_desc === 'Upload cancelled successfully') {
|
||||||
return parsed.message_body;
|
return parsed.message_body;
|
||||||
|
|||||||
@@ -290,8 +290,9 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
|
|||||||
formData.append('upload_id', response.upload_id);
|
formData.append('upload_id', response.upload_id);
|
||||||
formData.append('chunk_number', chunkIndex.toString());
|
formData.append('chunk_number', chunkIndex.toString());
|
||||||
formData.append('chunk', chunk);
|
formData.append('chunk', chunk);
|
||||||
|
console.log(`init chunkUpload`);
|
||||||
const chunkResponse = await chunkUpload(formData);
|
const chunkResponse = await chunkUpload(formData);
|
||||||
|
console.log(`chunkResponse - ${chunkResponse}`);
|
||||||
|
|
||||||
if (chunkResponse.message_desc !== 'Chunk uploaded successfully') {
|
if (chunkResponse.message_desc !== 'Chunk uploaded successfully') {
|
||||||
throw new Error('Er1: response error');
|
throw new Error('Er1: response error');
|
||||||
@@ -327,6 +328,7 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
|
|||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
setIsUploading(false);
|
setIsUploading(false);
|
||||||
|
setUploadId(null);
|
||||||
}
|
}
|
||||||
}, [isUploading, fileType]); // Добавьте зависимости
|
}, [isUploading, fileType]); // Добавьте зависимости
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user