32 lines
840 B
JavaScript
32 lines
840 B
JavaScript
import { useParams } from 'react-router-dom';
|
||
import TableTempForm from '../../components/TableForm/TableTempForm';
|
||
import { useEffect, useState } from 'react';
|
||
import { TablesApi } from '../../api/tables';
|
||
import { toast } from 'react-toastify';
|
||
import { InfoForHeader } from './InfoForHeader';
|
||
|
||
export default function TableTempPage() {
|
||
const { tableId } = useParams();
|
||
const [tableInfo, setTableInfo] = useState();
|
||
|
||
useEffect(() => {
|
||
if (!tableId) return;
|
||
TablesApi.getTemplateInfo(tableId)
|
||
.then((data) => {
|
||
if (data.result) {
|
||
setTableInfo(data.result);
|
||
}
|
||
})
|
||
.catch(() => {
|
||
toast.error('Ошибка получения информации о таблице');
|
||
});
|
||
}, [tableId]);
|
||
|
||
return (
|
||
<>
|
||
<InfoForHeader table={tableInfo} />
|
||
|
||
</>
|
||
);
|
||
}
|