Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2781 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2781 Rev 3432
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";
Línea 3... Línea 3...
3
 
3
 
4
import { axios } from 'utils/index'
4
import { axios } from "utils/index";
Línea 5... Línea 5...
5
import { addNotification } from '@app/redux/notification/notification.actions'
5
import { addNotification } from "@app/redux/notification/notification.actions";
Línea 6... Línea 6...
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",
Línea 36... Línea 36...
36
    headerName: 'Fecha'
36
    headerName: "Fecha",
37
  }
37
  },
38
]
38
];
Línea 39... Línea 39...
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
 
Línea 44... Línea 44...
44
  const getDevices = () => {
44
  const getDevices = () => {
45
    axios
45
    axios
46
      .get('/account-settings/devices')
46
      .get("/account-settings/devices")
Línea 47... Línea 47...
47
      .then(({ data: responseData }) => {
47
      .then((response) => {
48
        const { data, success } = responseData
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
        }
Línea 53... Línea 53...
53
 
53
 
54
        setDevices(data)
54
        setDevices(data);
55
      })
55
      })
Línea 56... Línea 56...
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
 
Línea 65... Línea 65...
65
  return (
65
  return (