Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3432 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3432 Rev 3719
Línea 1... Línea 1...
1
import React, { useEffect, useState } from "react";
1
import React, { useEffect, useState } from 'react';
2
import { useDispatch } from "react-redux";
2
import { useDispatch } from 'react-redux';
3
 
3
 
4
import { axios } from "utils/index";
4
import { axios } from '@utils/index.js';
5
import { addNotification } from "@app/redux/notification/notification.actions";
5
import { addNotification } from '@app/redux/notification/notification.actions';
6
 
6
 
7
import Table from "@components/table/Table";
7
import Table from '@components/table/Table';
8
 
8
 
9
const DevicesColumns = [
9
const DevicesColumns = [
10
  {
10
  {
11
    field: "platform",
11
    field: 'platform',
12
    headerName: "Plataforma",
12
    headerName: 'Plataforma'
13
  },
13
  },
14
  {
14
  {
15
    field: "brand",
15
    field: 'brand',
16
    headerName: "Marca",
16
    headerName: 'Marca'
17
  },
17
  },
18
  {
18
  {
19
    field: "manufacturer",
19
    field: 'manufacturer',
20
    headerName: "Fabricante",
20
    headerName: 'Fabricante'
21
  },
21
  },
22
  {
22
  {
23
    field: "model",
23
    field: 'model',
24
    headerName: "Modelo",
24
    headerName: 'Modelo'
25
  },
25
  },
26
  {
26
  {
27
    field: "version",
27
    field: 'version',
28
    headerName: "Versión",
28
    headerName: 'Versión'
29
  },
29
  },
30
  {
30
  {
31
    field: "ip",
31
    field: 'ip',
32
    headerName: "IP",
32
    headerName: 'IP'
33
  },
33
  },
34
  {
34
  {
35
    field: "updated_on",
35
    field: 'updated_on',
36
    headerName: "Fecha",
36
    headerName: 'Fecha'
37
  },
37
  }
38
];
38
];
39
 
39
 
40
const Devices = () => {
40
const Devices = () => {
41
  const [devices, setDevices] = useState({});
41
  const [devices, setDevices] = useState({});
42
  const dispatch = useDispatch();
42
  const dispatch = useDispatch();
43
 
43
 
44
  const getDevices = () => {
44
  const getDevices = () => {
45
    axios
45
    axios
46
      .get("/account-settings/devices")
46
      .get('/account-settings/devices')
47
      .then((response) => {
47
      .then((response) => {
48
        const { data, success } = response.data;
48
        const { data, success } = response.data;
49
 
49
 
50
        if (!success) {
50
        if (!success) {
51
          throw new Error("Error interno. Por favor, intente mas tarde");
51
          throw new Error('Error interno. Por favor, intente mas tarde');
52
        }
52
        }
53
 
53
 
54
        setDevices(data);
54
        setDevices(data);
55
      })
55
      })
56
      .catch((err) => {
56
      .catch((err) => {
57
        dispatch(addNotification({ style: "danger", msg: err.message }));
57
        dispatch(addNotification({ style: 'danger', msg: err.message }));
58
      });
58
      });
59
  };
59
  };
60
 
60
 
61
  useEffect(() => {
61
  useEffect(() => {
62
    getDevices();
62
    getDevices();
63
  }, []);
63
  }, []);
64
 
64
 
65
  return (
65
  return (
66
    <div className="acc-setting">
66
    <div className='acc-setting'>
67
      <h3>Navegadores</h3>
67
      <h3>Navegadores</h3>
68
      <div className="cp-field mb-3">
68
      <div className='cp-field mb-3'>
69
        <Table columns={DevicesColumns} rows={devices.items} />
69
        <Table columns={DevicesColumns} rows={devices.items} />
70
      </div>
70
      </div>
71
    </div>
71
    </div>
72
  );
72
  );
73
};
73
};
74
 
74
 
75
export default Devices;
75
export default Devices;