import { useState } from 'react' import { Box, Button, CircularProgress, Modal } from '@mui/material' import { DataGrid, GridColDef } from '@mui/x-data-grid' import { useRoles } from '../hooks/swrHooks' import { CreateField } from '../interfaces/create' import RoleService from '../services/RoleService' import FormFields from '../components/FormFields' export default function Roles() { const { roles, isError, isLoading } = useRoles() const [open, setOpen] = useState(false) const createFields: CreateField[] = [ { key: 'name', headerName: 'Название', type: 'string', required: true, defaultValue: '' }, { key: 'description', headerName: 'Описание', type: 'string', required: false, defaultValue: '' }, ] const columns: GridColDef[] = [ { field: 'id', headerName: 'ID', type: "number" }, { field: 'name', headerName: 'Название', flex: 1, editable: true }, { field: 'description', headerName: 'Описание', flex: 1, editable: true }, ]; if (isError) return