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'
4
import { axios } from "utils";
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 IPColumns = [
9
const IPColumns = [
10
  {
10
  {
11
    field: 'ip',
11
    field: "ip",
12
    headerName: 'IP'
12
    headerName: "IP",
13
  },
13
  },
14
  {
14
  {
15
    field: 'country_name',
15
    field: "country_name",
16
    headerName: 'País'
16
    headerName: "País",
17
  },
17
  },
18
  {
18
  {
19
    field: 'state_name',
19
    field: "state_name",
20
    headerName: 'Estado'
20
    headerName: "Estado",
21
  },
21
  },
22
  {
22
  {
23
    field: 'city',
23
    field: "city",
24
    headerName: 'Ciudad'
24
    headerName: "Ciudad",
25
  },
25
  },
26
  {
26
  {
27
    field: 'postal_code',
27
    field: "postal_code",
Línea 28... Línea 28...
28
    headerName: 'Código Postal'
28
    headerName: "Código Postal",
29
  }
29
  },
30
]
30
];
Línea 31... Línea 31...
31
 
31
 
32
const Ips = () => {
32
const Ips = () => {
33
  const [ips, setIps] = useState({})
33
  const [ips, setIps] = useState({});
34
  const dispatch = useDispatch()
34
  const dispatch = useDispatch();
35
 
35
 
Línea 36... Línea 36...
36
  const getDevices = () => {
36
  const getDevices = () => {
37
    axios
37
    axios
38
      .get('/account-settings/ips')
38
      .get("/account-settings/ips")
Línea 39... Línea 39...
39
      .then(({ data: responseData }) => {
39
      .then((response) => {
40
        const { data, success } = responseData
40
        const { data, success } = response.data;
41
 
41
 
42
        if (!success) {
42
        if (!success) {
43
          throw new Error('Error interno. Por favor, intente mas tarde')
43
          throw new Error("Error interno. Por favor, intente mas tarde");
44
        }
44
        }
Línea 45... Línea 45...
45
 
45
 
46
        setIps(data)
46
        setIps(data);
47
      })
47
      })
Línea 48... Línea 48...
48
      .catch((err) => {
48
      .catch((err) => {
49
        dispatch(addNotification({ style: 'danger', msg: err.message }))
49
        dispatch(addNotification({ style: "danger", msg: err.message }));
50
      })
50
      });
51
  }
51
  };
52
 
52
 
53
  useEffect(() => {
53
  useEffect(() => {
54
    getDevices()
54
    getDevices();
55
  }, [])
55
  }, []);
56
 
56
 
Línea 57... Línea 57...
57
  return (
57
  return (