добился какой то работы с API

This commit is contained in:
2025-07-20 15:25:51 +03:00
parent 0d00245bf2
commit 71b5ea4e7b
21 changed files with 1910 additions and 1037 deletions

View File

@@ -1,4 +1,4 @@
import { parseExcelFile } from '@/services/excelSevice'
import { parseExcelFile } from '@/services/fileApiSevice'
import { Template } from '@/types/template'
import React, { useState } from 'react'
import { ExcelUploadPanel } from './ExcelUploadPanel'
@@ -27,19 +27,27 @@ export const TemplateEditor: React.FC<TemplateEditorProps> = ({
if (!file) return
setIsLoading(true)
try {
const { data, mergedCells } = await parseExcelFile(file)
const { fileId, data, mergedCells } = await parseExcelFile(
file,
template.id
)
setExcelData(data)
setEditedTemplate(prev => ({
...prev,
const updatedTemplate = {
...template,
excelFile: file,
excelData: data,
mergedCells,
updatedAt: new Date(),
}))
}
setEditedTemplate(updatedTemplate)
setDataVersion(v => v + 1)
console.log('✅ Файл загружен с ID:', fileId)
} catch (err) {
console.error(err)
alert('Ошибка при чтении Excel файла')
alert('Ошибка при загрузке Excel файла на сервер')
} finally {
setIsLoading(false)
}