Rev 2781 | Ir a la última revisión | 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";
import { addNotification } from "@app/redux/notification/notification.actions";
import Table from "@components/table/Table";
const IPColumns = [
{
field: "ip",
headerName: "IP",
},
{
field: "country_name",
headerName: "País",
},
{
field: "state_name",
headerName: "Estado",
},
{
field: "city",
headerName: "Ciudad",
},
{
field: "postal_code",
headerName: "Código Postal",
},
];
const Ips = () => {
const [ips, setIps] = useState({});
const dispatch = useDispatch();
const getDevices = () => {
axios
.get("/account-settings/ips")
.then((response) => {
const { data, success } = response.data;
if (!success) {
throw new Error("Error interno. Por favor, intente mas tarde");
}
setIps(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={IPColumns} rows={ips.items} />
</div>
</div>
);
};
export default Ips;