Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2781 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3719 stevensc 1
import React, { useEffect, useState } from 'react';
2
import { useDispatch } from 'react-redux';
3
 
4
import { axios } from '@utils/index.js';
5
import { addNotification } from '@app/redux/notification/notification.actions';
6
 
7
import Table from '@components/table/Table';
8
 
9
const BrowserTableColumns = [
10
  {
11
    field: 'platform',
12
    headerName: 'Plataforma'
13
  },
14
  {
15
    field: 'browser',
16
    headerName: 'Navegadores'
17
  },
18
  {
19
    field: 'device_type',
20
    headerName: 'Tipo'
21
  },
22
  {
23
    field: 'version',
24
    headerName: 'Versión'
25
  },
26
  {
27
    field: 'updated_on',
28
    headerName: 'Fecha'
29
  }
30
];
31
 
32
const Browsers = () => {
33
  const [browserData, setBrowserData] = useState({});
34
  const dispatch = useDispatch();
35
 
36
  const getBrowserData = () => {
37
    axios
38
      .get('/account-settings/browsers')
39
      .then((response) => {
40
        const { data } = response.data;
41
        setBrowserData(data);
42
      })
43
      .catch((err) => {
44
        dispatch(addNotification({ style: 'danger', msg: err.message }));
45
      });
46
  };
47
 
48
  useEffect(() => {
49
    getBrowserData();
50
  }, []);
51
 
52
  return (
53
    <div className='acc-setting'>
54
      <h3>Navegadores</h3>
55
      <div className='cp-field mb-3'>
56
        <Table columns={BrowserTableColumns} rows={browserData.items} />
57
      </div>
58
    </div>
59
  );
60
};
61
 
62
export default Browsers;