feat: add ZIP archive detection and automatic catalog refetching on bulk upload
All checks were successful
Beta CI/CD Pipeline / build-and-test (push) Successful in 1m30s
Beta CI/CD Pipeline / deploy-beta (push) Successful in 41s

This commit is contained in:
vickytechkey 2026-10-02 14:23:24 +05:30
parent b0b75531cc
commit e2d2288ed8

View file

@ -8,6 +8,7 @@ import {
FileText
} from 'lucide-react';
import { api } from '../../services/api';
import { useSeller } from '../../context/SellerContext';
import { formatISTDateTime } from '../../utils/date';
interface BatchLog {
@ -21,6 +22,7 @@ interface BatchLog {
}
export const BulkUploadPage: React.FC = () => {
const { fetchData } = useSeller();
const [isUploading, setIsUploading] = useState(false);
const [uploadSuccess, setUploadSuccess] = useState<string | null>(null);
const [errorMsg, setErrorMsg] = useState<string | null>(null);
@ -47,10 +49,15 @@ export const BulkUploadPage: React.FC = () => {
setErrorMsg(null);
const formData = new FormData();
formData.append('csv_file', file);
if (file.name.toLowerCase().endsWith('.zip')) {
formData.append('zip_file', file);
} else {
formData.append('csv_file', file);
}
try {
const res = await api.bulkUploadProducts(formData);
await fetchData();
const count = res.products ? res.products.length : 0;
setUploadSuccess(`Successfully processed batch file! ${count} craft SKUs created/updated in your catalog.`);