Rev 3432 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React, { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import { axios } from '@utils/index.js';
import { addNotification } from '@app/redux/notification/notification.actions';
import Table from '@components/table/Table';
const DevicesColumns = [
{
field: 'platform',
headerName: 'Plataforma'
},
{
field: 'brand',
headerName: 'Marca'
},
{
field: 'manufacturer',
headerName: 'Fabricante'
},
{
field: 'model',
headerName: 'Modelo'
},
{
field: 'version',
headerName: 'Versión'
},
{
field: 'ip',
headerName: 'IP'
},
{
field: 'updated_on',
headerName: 'Fecha'
}
];
const Devices = () => {
const [devices, setDevices] = useState({});
const dispatch = useDispatch();
const getDevices = () => {
axios
.get('/account-settings/devices')
.then((response) => {
const { data, success } = response.data;
if (!success) {
throw new Error('Error interno. Por favor, intente mas tarde');
}
setDevices(data);
})
.catch((err) => {
dispatch(addNotification({ style: 'danger', msg: err.message }));
});
};
useEffect(() => {
getDevices();
}, []);
return (
<div className='acc-setting'>
<h3>Navegadores</h3>
<div className='cp-field mb-3'>
<Table columns={DevicesColumns} rows={devices.items} />
</div>
</div>
);
};
export default Devices;